
co.elastic.clients.elasticsearch.slm.ElasticsearchSlmAsyncClient 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.slm;
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 slm namespace.
*/
public class ElasticsearchSlmAsyncClient extends ApiClient {
public ElasticsearchSlmAsyncClient(ElasticsearchTransport transport) {
super(transport, null);
}
public ElasticsearchSlmAsyncClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) {
super(transport, transportOptions);
}
@Override
public ElasticsearchSlmAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) {
return new ElasticsearchSlmAsyncClient(this.transport, transportOptions);
}
// ----- Endpoint: slm.delete_lifecycle
/**
* Delete a policy. Delete a snapshot lifecycle policy definition. This
* operation prevents any future snapshots from being taken but does not cancel
* in-progress snapshots or remove previously-taken snapshots.
*
* @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 policy. Delete a snapshot lifecycle policy definition. This
* operation prevents any future snapshots from being taken but does not cancel
* in-progress snapshots or remove previously-taken snapshots.
*
* @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: slm.execute_lifecycle
/**
* Run a policy. Immediately create a snapshot according to the snapshot
* lifecycle policy without waiting for the scheduled time. The snapshot policy
* is normally applied according to its schedule, but you might want to manually
* run a policy before performing an upgrade or other maintenance.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture executeLifecycle(ExecuteLifecycleRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ExecuteLifecycleRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Run a policy. Immediately create a snapshot according to the snapshot
* lifecycle policy without waiting for the scheduled time. The snapshot policy
* is normally applied according to its schedule, but you might want to manually
* run a policy before performing an upgrade or other maintenance.
*
* @param fn
* a function that initializes a builder to create the
* {@link ExecuteLifecycleRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture executeLifecycle(
Function> fn) {
return executeLifecycle(fn.apply(new ExecuteLifecycleRequest.Builder()).build());
}
// ----- Endpoint: slm.execute_retention
/**
* Run a retention policy. Manually apply the retention policy to force
* immediate removal of snapshots that are expired according to the snapshot
* lifecycle policy retention rules. The retention policy is normally applied
* according to its schedule.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture executeRetention(ExecuteRetentionRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ExecuteRetentionRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Run a retention policy. Manually apply the retention policy to force
* immediate removal of snapshots that are expired according to the snapshot
* lifecycle policy retention rules. The retention policy is normally applied
* according to its schedule.
*
* @param fn
* a function that initializes a builder to create the
* {@link ExecuteRetentionRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture executeRetention(
Function> fn) {
return executeRetention(fn.apply(new ExecuteRetentionRequest.Builder()).build());
}
/**
* Run a retention policy. Manually apply the retention policy to force
* immediate removal of snapshots that are expired according to the snapshot
* lifecycle policy retention rules. The retention policy is normally applied
* according to its schedule.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture executeRetention() {
return this.transport.performRequestAsync(new ExecuteRetentionRequest.Builder().build(),
ExecuteRetentionRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: slm.get_lifecycle
/**
* Get policy information. Get snapshot lifecycle policy definitions and
* information about the latest snapshot attempts.
*
* @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 policy information. Get snapshot lifecycle policy definitions and
* information about the latest snapshot attempts.
*
* @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 policy information. Get snapshot lifecycle policy definitions and
* information about the latest snapshot attempts.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getLifecycle() {
return this.transport.performRequestAsync(new GetLifecycleRequest.Builder().build(),
GetLifecycleRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: slm.get_stats
/**
* Get snapshot lifecycle management statistics. Get global and policy-level
* statistics about actions taken by snapshot lifecycle management.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getStats(GetStatsRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) GetStatsRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Get snapshot lifecycle management statistics. Get global and policy-level
* statistics about actions taken by snapshot lifecycle management.
*
* @param fn
* a function that initializes a builder to create the
* {@link GetStatsRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture getStats(
Function> fn) {
return getStats(fn.apply(new GetStatsRequest.Builder()).build());
}
/**
* Get snapshot lifecycle management statistics. Get global and policy-level
* statistics about actions taken by snapshot lifecycle management.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getStats() {
return this.transport.performRequestAsync(new GetStatsRequest.Builder().build(), GetStatsRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: slm.get_status
/**
* Get the snapshot lifecycle management status.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getStatus(GetSlmStatusRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) GetSlmStatusRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Get the snapshot lifecycle management status.
*
* @param fn
* a function that initializes a builder to create the
* {@link GetSlmStatusRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture getStatus(
Function> fn) {
return getStatus(fn.apply(new GetSlmStatusRequest.Builder()).build());
}
/**
* Get the snapshot lifecycle management status.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getStatus() {
return this.transport.performRequestAsync(new GetSlmStatusRequest.Builder().build(),
GetSlmStatusRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: slm.put_lifecycle
/**
* Create or update a policy. Create or update a snapshot lifecycle policy. If
* the policy already exists, this request increments the policy version. Only
* the latest version of a policy is stored.
*
* @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 policy. Create or update a snapshot lifecycle policy. If
* the policy already exists, this request increments the policy version. Only
* the latest version of a policy is stored.
*
* @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: slm.start
/**
* Start snapshot lifecycle management. Snapshot lifecycle management (SLM)
* starts automatically when a cluster is formed. Manually starting SLM is
* necessary only if it has been stopped using the stop SLM API.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture start(StartSlmRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) StartSlmRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Start snapshot lifecycle management. Snapshot lifecycle management (SLM)
* starts automatically when a cluster is formed. Manually starting SLM is
* necessary only if it has been stopped using the stop SLM API.
*
* @param fn
* a function that initializes a builder to create the
* {@link StartSlmRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture start(
Function> fn) {
return start(fn.apply(new StartSlmRequest.Builder()).build());
}
/**
* Start snapshot lifecycle management. Snapshot lifecycle management (SLM)
* starts automatically when a cluster is formed. Manually starting SLM is
* necessary only if it has been stopped using the stop SLM API.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture start() {
return this.transport.performRequestAsync(new StartSlmRequest.Builder().build(), StartSlmRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: slm.stop
/**
* Stop snapshot lifecycle management. Stop all snapshot lifecycle management
* (SLM) operations and the SLM plugin. This API is useful when you are
* performing maintenance on a cluster and need to prevent SLM from performing
* any actions on your data streams or indices. Stopping SLM does not stop any
* snapshots that are in progress. You can manually trigger snapshots with the
* run snapshot lifecycle policy API even if SLM is stopped.
*
* The API returns a response as soon as the request is acknowledged, but the
* plugin might continue to run until in-progress operations complete and it can
* be safely stopped. Use the get snapshot lifecycle management status API to
* see if SLM is running.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture stop(StopSlmRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) StopSlmRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Stop snapshot lifecycle management. Stop all snapshot lifecycle management
* (SLM) operations and the SLM plugin. This API is useful when you are
* performing maintenance on a cluster and need to prevent SLM from performing
* any actions on your data streams or indices. Stopping SLM does not stop any
* snapshots that are in progress. You can manually trigger snapshots with the
* run snapshot lifecycle policy API even if SLM is stopped.
*
* The API returns a response as soon as the request is acknowledged, but the
* plugin might continue to run until in-progress operations complete and it can
* be safely stopped. Use the get snapshot lifecycle management status API to
* see if SLM is running.
*
* @param fn
* a function that initializes a builder to create the
* {@link StopSlmRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture stop(
Function> fn) {
return stop(fn.apply(new StopSlmRequest.Builder()).build());
}
/**
* Stop snapshot lifecycle management. Stop all snapshot lifecycle management
* (SLM) operations and the SLM plugin. This API is useful when you are
* performing maintenance on a cluster and need to prevent SLM from performing
* any actions on your data streams or indices. Stopping SLM does not stop any
* snapshots that are in progress. You can manually trigger snapshots with the
* run snapshot lifecycle policy API even if SLM is stopped.
*
* The API returns a response as soon as the request is acknowledged, but the
* plugin might continue to run until in-progress operations complete and it can
* be safely stopped. Use the get snapshot lifecycle management status API to
* see if SLM is running.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture stop() {
return this.transport.performRequestAsync(new StopSlmRequest.Builder().build(), StopSlmRequest._ENDPOINT,
this.transportOptions);
}
}