
co.elastic.clients.elasticsearch.ilm.ElasticsearchIlmAsyncClient Maven / Gradle / Ivy
Show all versions of org.apache.servicemix.bundles.elasticsearch-java
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package co.elastic.clients.elasticsearch.ilm;
import co.elastic.clients.ApiClient;
import co.elastic.clients.elasticsearch._types.ErrorResponse;
import co.elastic.clients.transport.ElasticsearchTransport;
import co.elastic.clients.transport.Endpoint;
import co.elastic.clients.transport.JsonEndpoint;
import co.elastic.clients.transport.Transport;
import co.elastic.clients.transport.TransportOptions;
import co.elastic.clients.util.ObjectBuilder;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import javax.annotation.Nullable;
//----------------------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------------------
//
// This code is generated from the Elasticsearch API specification
// at https://github.com/elastic/elasticsearch-specification
//
// Manual updates to this file will be lost when the code is
// re-generated.
//
// If you find a property that is missing or wrongly typed, please
// open an issue or a PR on the API specification repository.
//
//----------------------------------------------------------------
/**
* Client for the ilm namespace.
*/
public class ElasticsearchIlmAsyncClient extends ApiClient {
public ElasticsearchIlmAsyncClient(ElasticsearchTransport transport) {
super(transport, null);
}
public ElasticsearchIlmAsyncClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) {
super(transport, transportOptions);
}
@Override
public ElasticsearchIlmAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) {
return new ElasticsearchIlmAsyncClient(this.transport, transportOptions);
}
// ----- Endpoint: ilm.delete_lifecycle
/**
* Delete a lifecycle policy. You cannot delete policies that are currently in
* use. If the policy is being used to manage any indices, the request fails and
* returns an error.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture deleteLifecycle(DeleteLifecycleRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) DeleteLifecycleRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Delete a lifecycle policy. You cannot delete policies that are currently in
* use. If the policy is being used to manage any indices, the request fails and
* returns an error.
*
* @param fn
* a function that initializes a builder to create the
* {@link DeleteLifecycleRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture deleteLifecycle(
Function> fn) {
return deleteLifecycle(fn.apply(new DeleteLifecycleRequest.Builder()).build());
}
// ----- Endpoint: ilm.explain_lifecycle
/**
* Explain the lifecycle state. Get the current lifecycle status for one or more
* indices. For data streams, the API retrieves the current lifecycle status for
* the stream's backing indices.
*
* The response indicates when the index entered each lifecycle state, provides
* the definition of the running phase, and information about any failures.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture explainLifecycle(ExplainLifecycleRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ExplainLifecycleRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Explain the lifecycle state. Get the current lifecycle status for one or more
* indices. For data streams, the API retrieves the current lifecycle status for
* the stream's backing indices.
*
* The response indicates when the index entered each lifecycle state, provides
* the definition of the running phase, and information about any failures.
*
* @param fn
* a function that initializes a builder to create the
* {@link ExplainLifecycleRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture explainLifecycle(
Function> fn) {
return explainLifecycle(fn.apply(new ExplainLifecycleRequest.Builder()).build());
}
// ----- Endpoint: ilm.get_lifecycle
/**
* Get lifecycle policies.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getLifecycle(GetLifecycleRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) GetLifecycleRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Get lifecycle policies.
*
* @param fn
* a function that initializes a builder to create the
* {@link GetLifecycleRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture getLifecycle(
Function> fn) {
return getLifecycle(fn.apply(new GetLifecycleRequest.Builder()).build());
}
/**
* Get lifecycle policies.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getLifecycle() {
return this.transport.performRequestAsync(new GetLifecycleRequest.Builder().build(),
GetLifecycleRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: ilm.get_status
/**
* Get the ILM status.
*
* Get the current index lifecycle management status.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getStatus() {
return this.transport.performRequestAsync(GetIlmStatusRequest._INSTANCE, GetIlmStatusRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: ilm.migrate_to_data_tiers
/**
* Migrate to data tiers routing. Switch the indices, ILM policies, and legacy,
* composable, and component templates from using custom node attributes and
* attribute-based allocation filters to using data tiers. Optionally, delete
* one legacy index template. Using node roles enables ILM to automatically move
* the indices between data tiers.
*
* Migrating away from custom node attributes routing can be manually performed.
* This API provides an automated way of performing three out of the four manual
* steps listed in the migration guide:
*
* - Stop setting the custom hot attribute on new indices.
* - Remove custom allocation settings from existing ILM policies.
* - Replace custom allocation settings from existing indices with the
* corresponding tier preference.
*
*
* ILM must be stopped before performing the migration. Use the stop ILM and get
* ILM status APIs to wait until the reported operation mode is
* STOPPED
.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture migrateToDataTiers(MigrateToDataTiersRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) MigrateToDataTiersRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Migrate to data tiers routing. Switch the indices, ILM policies, and legacy,
* composable, and component templates from using custom node attributes and
* attribute-based allocation filters to using data tiers. Optionally, delete
* one legacy index template. Using node roles enables ILM to automatically move
* the indices between data tiers.
*
* Migrating away from custom node attributes routing can be manually performed.
* This API provides an automated way of performing three out of the four manual
* steps listed in the migration guide:
*
* - Stop setting the custom hot attribute on new indices.
* - Remove custom allocation settings from existing ILM policies.
* - Replace custom allocation settings from existing indices with the
* corresponding tier preference.
*
*
* ILM must be stopped before performing the migration. Use the stop ILM and get
* ILM status APIs to wait until the reported operation mode is
* STOPPED
.
*
* @param fn
* a function that initializes a builder to create the
* {@link MigrateToDataTiersRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture migrateToDataTiers(
Function> fn) {
return migrateToDataTiers(fn.apply(new MigrateToDataTiersRequest.Builder()).build());
}
/**
* Migrate to data tiers routing. Switch the indices, ILM policies, and legacy,
* composable, and component templates from using custom node attributes and
* attribute-based allocation filters to using data tiers. Optionally, delete
* one legacy index template. Using node roles enables ILM to automatically move
* the indices between data tiers.
*
* Migrating away from custom node attributes routing can be manually performed.
* This API provides an automated way of performing three out of the four manual
* steps listed in the migration guide:
*
* - Stop setting the custom hot attribute on new indices.
* - Remove custom allocation settings from existing ILM policies.
* - Replace custom allocation settings from existing indices with the
* corresponding tier preference.
*
*
* ILM must be stopped before performing the migration. Use the stop ILM and get
* ILM status APIs to wait until the reported operation mode is
* STOPPED
.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture migrateToDataTiers() {
return this.transport.performRequestAsync(new MigrateToDataTiersRequest.Builder().build(),
MigrateToDataTiersRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: ilm.move_to_step
/**
* Move to a lifecycle step. Manually move an index into a specific step in the
* lifecycle policy and run that step.
*
* WARNING: This operation can result in the loss of data. Manually moving an
* index into a specific step runs that step even if it has already been
* performed. This is a potentially destructive action and this should be
* considered an expert level API.
*
* You must specify both the current step and the step to be executed in the
* body of the request. The request will fail if the current step does not match
* the step currently running for the index This is to prevent the index from
* being moved from an unexpected step into the next step.
*
* When specifying the target (next_step
) to which the index will
* be moved, either the name or both the action and name fields are optional. If
* only the phase is specified, the index will move to the first step of the
* first action in the target phase. If the phase and action are specified, the
* index will move to the first step of the specified action in the specified
* phase. Only actions specified in the ILM policy are considered valid. An
* index cannot move to a step that is not part of its policy.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture moveToStep(MoveToStepRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) MoveToStepRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Move to a lifecycle step. Manually move an index into a specific step in the
* lifecycle policy and run that step.
*
* WARNING: This operation can result in the loss of data. Manually moving an
* index into a specific step runs that step even if it has already been
* performed. This is a potentially destructive action and this should be
* considered an expert level API.
*
* You must specify both the current step and the step to be executed in the
* body of the request. The request will fail if the current step does not match
* the step currently running for the index This is to prevent the index from
* being moved from an unexpected step into the next step.
*
* When specifying the target (next_step
) to which the index will
* be moved, either the name or both the action and name fields are optional. If
* only the phase is specified, the index will move to the first step of the
* first action in the target phase. If the phase and action are specified, the
* index will move to the first step of the specified action in the specified
* phase. Only actions specified in the ILM policy are considered valid. An
* index cannot move to a step that is not part of its policy.
*
* @param fn
* a function that initializes a builder to create the
* {@link MoveToStepRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture moveToStep(
Function> fn) {
return moveToStep(fn.apply(new MoveToStepRequest.Builder()).build());
}
// ----- Endpoint: ilm.put_lifecycle
/**
* Create or update a lifecycle policy. If the specified policy exists, it is
* replaced and the policy version is incremented.
*
* NOTE: Only the latest version of the policy is stored, you cannot revert to
* previous versions.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture putLifecycle(PutLifecycleRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) PutLifecycleRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Create or update a lifecycle policy. If the specified policy exists, it is
* replaced and the policy version is incremented.
*
* NOTE: Only the latest version of the policy is stored, you cannot revert to
* previous versions.
*
* @param fn
* a function that initializes a builder to create the
* {@link PutLifecycleRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture putLifecycle(
Function> fn) {
return putLifecycle(fn.apply(new PutLifecycleRequest.Builder()).build());
}
// ----- Endpoint: ilm.remove_policy
/**
* Remove policies from an index. Remove the assigned lifecycle policies from an
* index or a data stream's backing indices. It also stops managing the indices.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture removePolicy(RemovePolicyRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) RemovePolicyRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Remove policies from an index. Remove the assigned lifecycle policies from an
* index or a data stream's backing indices. It also stops managing the indices.
*
* @param fn
* a function that initializes a builder to create the
* {@link RemovePolicyRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture removePolicy(
Function> fn) {
return removePolicy(fn.apply(new RemovePolicyRequest.Builder()).build());
}
// ----- Endpoint: ilm.retry
/**
* Retry a policy. Retry running the lifecycle policy for an index that is in
* the ERROR step. The API sets the policy back to the step where the error
* occurred and runs the step. Use the explain lifecycle state API to determine
* whether an index is in the ERROR step.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture retry(RetryRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) RetryRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Retry a policy. Retry running the lifecycle policy for an index that is in
* the ERROR step. The API sets the policy back to the step where the error
* occurred and runs the step. Use the explain lifecycle state API to determine
* whether an index is in the ERROR step.
*
* @param fn
* a function that initializes a builder to create the
* {@link RetryRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture retry(
Function> fn) {
return retry(fn.apply(new RetryRequest.Builder()).build());
}
// ----- Endpoint: ilm.start
/**
* Start the ILM plugin. Start the index lifecycle management plugin if it is
* currently stopped. ILM is started automatically when the cluster is formed.
* Restarting ILM is necessary only when it has been stopped using the stop ILM
* API.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture start(StartIlmRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) StartIlmRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Start the ILM plugin. Start the index lifecycle management plugin if it is
* currently stopped. ILM is started automatically when the cluster is formed.
* Restarting ILM is necessary only when it has been stopped using the stop ILM
* API.
*
* @param fn
* a function that initializes a builder to create the
* {@link StartIlmRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture start(
Function> fn) {
return start(fn.apply(new StartIlmRequest.Builder()).build());
}
/**
* Start the ILM plugin. Start the index lifecycle management plugin if it is
* currently stopped. ILM is started automatically when the cluster is formed.
* Restarting ILM is necessary only when it has been stopped using the stop ILM
* API.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture start() {
return this.transport.performRequestAsync(new StartIlmRequest.Builder().build(), StartIlmRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: ilm.stop
/**
* Stop the ILM plugin. Halt all lifecycle management operations and stop the
* index lifecycle management plugin. This is useful when you are performing
* maintenance on the cluster and need to prevent ILM from performing any
* actions on your indices.
*
* The API returns as soon as the stop request has been acknowledged, but the
* plugin might continue to run until in-progress operations complete and the
* plugin can be safely stopped. Use the get ILM status API to check whether ILM
* is running.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture stop(StopIlmRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) StopIlmRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Stop the ILM plugin. Halt all lifecycle management operations and stop the
* index lifecycle management plugin. This is useful when you are performing
* maintenance on the cluster and need to prevent ILM from performing any
* actions on your indices.
*
* The API returns as soon as the stop request has been acknowledged, but the
* plugin might continue to run until in-progress operations complete and the
* plugin can be safely stopped. Use the get ILM status API to check whether ILM
* is running.
*
* @param fn
* a function that initializes a builder to create the
* {@link StopIlmRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture stop(
Function> fn) {
return stop(fn.apply(new StopIlmRequest.Builder()).build());
}
/**
* Stop the ILM plugin. Halt all lifecycle management operations and stop the
* index lifecycle management plugin. This is useful when you are performing
* maintenance on the cluster and need to prevent ILM from performing any
* actions on your indices.
*
* The API returns as soon as the stop request has been acknowledged, but the
* plugin might continue to run until in-progress operations complete and the
* plugin can be safely stopped. Use the get ILM status API to check whether ILM
* is running.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture stop() {
return this.transport.performRequestAsync(new StopIlmRequest.Builder().build(), StopIlmRequest._ENDPOINT,
this.transportOptions);
}
}