All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.elastic.clients.elasticsearch.ilm.ElasticsearchIlmClient Maven / Gradle / Ivy

The newest version!
/*
 * 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.ElasticsearchException;
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.io.IOException;
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 ElasticsearchIlmClient extends ApiClient {

	public ElasticsearchIlmClient(ElasticsearchTransport transport) {
		super(transport, null);
	}

	public ElasticsearchIlmClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) {
		super(transport, transportOptions);
	}

	@Override
	public ElasticsearchIlmClient withTransportOptions(@Nullable TransportOptions transportOptions) {
		return new ElasticsearchIlmClient(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 DeleteLifecycleResponse deleteLifecycle(DeleteLifecycleRequest request)
			throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) DeleteLifecycleRequest._ENDPOINT;

		return this.transport.performRequest(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 DeleteLifecycleResponse deleteLifecycle(
			Function> fn)
			throws IOException, ElasticsearchException {
		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 ExplainLifecycleResponse explainLifecycle(ExplainLifecycleRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) ExplainLifecycleRequest._ENDPOINT; return this.transport.performRequest(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 ExplainLifecycleResponse explainLifecycle( Function> fn) throws IOException, ElasticsearchException { return explainLifecycle(fn.apply(new ExplainLifecycleRequest.Builder()).build()); } // ----- Endpoint: ilm.get_lifecycle /** * Get lifecycle policies. * * @see Documentation * on elastic.co */ public GetLifecycleResponse getLifecycle(GetLifecycleRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) GetLifecycleRequest._ENDPOINT; return this.transport.performRequest(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 GetLifecycleResponse getLifecycle( Function> fn) throws IOException, ElasticsearchException { return getLifecycle(fn.apply(new GetLifecycleRequest.Builder()).build()); } /** * Get lifecycle policies. * * @see Documentation * on elastic.co */ public GetLifecycleResponse getLifecycle() throws IOException, ElasticsearchException { return this.transport.performRequest(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 GetIlmStatusResponse getStatus() throws IOException, ElasticsearchException { return this.transport.performRequest(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: *

    *
  1. Stop setting the custom hot attribute on new indices.
  2. *
  3. Remove custom allocation settings from existing ILM policies.
  4. *
  5. Replace custom allocation settings from existing indices with the * corresponding tier preference.
  6. *
*

* 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 MigrateToDataTiersResponse migrateToDataTiers(MigrateToDataTiersRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) MigrateToDataTiersRequest._ENDPOINT; return this.transport.performRequest(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: *

    *
  1. Stop setting the custom hot attribute on new indices.
  2. *
  3. Remove custom allocation settings from existing ILM policies.
  4. *
  5. Replace custom allocation settings from existing indices with the * corresponding tier preference.
  6. *
*

* 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 MigrateToDataTiersResponse migrateToDataTiers( Function> fn) throws IOException, ElasticsearchException { 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: *

    *
  1. Stop setting the custom hot attribute on new indices.
  2. *
  3. Remove custom allocation settings from existing ILM policies.
  4. *
  5. Replace custom allocation settings from existing indices with the * corresponding tier preference.
  6. *
*

* 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 MigrateToDataTiersResponse migrateToDataTiers() throws IOException, ElasticsearchException { return this.transport.performRequest(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 MoveToStepResponse moveToStep(MoveToStepRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) MoveToStepRequest._ENDPOINT; return this.transport.performRequest(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 MoveToStepResponse moveToStep(Function> fn) throws IOException, ElasticsearchException { 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 PutLifecycleResponse putLifecycle(PutLifecycleRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) PutLifecycleRequest._ENDPOINT; return this.transport.performRequest(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 PutLifecycleResponse putLifecycle( Function> fn) throws IOException, ElasticsearchException { 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 RemovePolicyResponse removePolicy(RemovePolicyRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) RemovePolicyRequest._ENDPOINT; return this.transport.performRequest(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 RemovePolicyResponse removePolicy( Function> fn) throws IOException, ElasticsearchException { 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 RetryResponse retry(RetryRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) RetryRequest._ENDPOINT; return this.transport.performRequest(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 RetryResponse retry(Function> fn) throws IOException, ElasticsearchException { 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 StartIlmResponse start(StartIlmRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) StartIlmRequest._ENDPOINT; return this.transport.performRequest(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 StartIlmResponse start(Function> fn) throws IOException, ElasticsearchException { 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 StartIlmResponse start() throws IOException, ElasticsearchException { return this.transport.performRequest(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 StopIlmResponse stop(StopIlmRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) StopIlmRequest._ENDPOINT; return this.transport.performRequest(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 StopIlmResponse stop(Function> fn) throws IOException, ElasticsearchException { 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 StopIlmResponse stop() throws IOException, ElasticsearchException { return this.transport.performRequest(new StopIlmRequest.Builder().build(), StopIlmRequest._ENDPOINT, this.transportOptions); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy