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

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

/*
 * 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

	/**
	 * Deletes the specified lifecycle policy definition. 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);
	}

	/**
	 * Deletes the specified lifecycle policy definition. 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

	/**
	 * Retrieves information about the index’s current lifecycle state, such as the
	 * currently executing phase, action, and step. Shows when the index entered
	 * each one, 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);
	}

	/**
	 * Retrieves information about the index’s current lifecycle state, such as the
	 * currently executing phase, action, and step. Shows when the index entered
	 * each one, 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

	/**
	 * Retrieves a lifecycle policy.
	 * 
	 * @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);
	}

	/**
	 * Retrieves a lifecycle policy.
	 * 
	 * @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());
	}

	/**
	 * Retrieves a lifecycle policy.
	 * 
	 * @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

	/**
	 * Retrieves the current index lifecycle management (ILM) 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

	/**
	 * Switches the indices, ILM policies, and legacy, composable and component
	 * templates from using custom node attributes and attribute-based allocation
	 * filters to using data tiers, and optionally deletes one legacy index
	 * template.+ Using node roles enables ILM to automatically move the indices
	 * between data tiers.
	 * 
	 * @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);
	}

	/**
	 * Switches the indices, ILM policies, and legacy, composable and component
	 * templates from using custom node attributes and attribute-based allocation
	 * filters to using data tiers, and optionally deletes one legacy index
	 * template.+ Using node roles enables ILM to automatically move the indices
	 * between data tiers.
	 * 
	 * @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());
	}

	/**
	 * Switches the indices, ILM policies, and legacy, composable and component
	 * templates from using custom node attributes and attribute-based allocation
	 * filters to using data tiers, and optionally deletes one legacy index
	 * template.+ Using node roles enables ILM to automatically move the indices
	 * between data tiers.
	 * 
	 * @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

	/**
	 * Manually moves an index into the specified step and executes that step.
	 * 
	 * @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);
	}

	/**
	 * Manually moves an index into the specified step and executes that step.
	 * 
	 * @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

	/**
	 * Creates a lifecycle policy. If the specified policy exists, the policy is
	 * replaced and the policy version is incremented.
	 * 
	 * @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);
	}

	/**
	 * Creates a lifecycle policy. If the specified policy exists, the policy is
	 * replaced and the policy version is incremented.
	 * 
	 * @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

	/**
	 * Removes the assigned lifecycle policy and stops managing the specified index
	 * 
	 * @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);
	}

	/**
	 * Removes the assigned lifecycle policy and stops managing the specified index
	 * 
	 * @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

	/**
	 * Retries executing the policy for an index that 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);
	}

	/**
	 * Retries executing the policy for an index that 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 index lifecycle management (ILM) plugin.
	 * 
	 * @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 index lifecycle management (ILM) plugin.
	 * 
	 * @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 index lifecycle management (ILM) plugin.
	 * 
	 * @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

	/**
	 * Halts all lifecycle management operations and stops the index lifecycle
	 * management (ILM) plugin
	 * 
	 * @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);
	}

	/**
	 * Halts all lifecycle management operations and stops the index lifecycle
	 * management (ILM) plugin
	 * 
	 * @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());
	}

	/**
	 * Halts all lifecycle management operations and stops the index lifecycle
	 * management (ILM) plugin
	 * 
	 * @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