co.elastic.clients.elasticsearch.slm.ElasticsearchSlmClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elasticsearch-java Show documentation
Show all versions of elasticsearch-java Show documentation
Elasticsearch Java API Client
/*
* 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.
*/
//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------
package co.elastic.clients.elasticsearch.slm;
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;
/**
* Client for the slm namespace.
*/
public class ElasticsearchSlmClient extends ApiClient {
public ElasticsearchSlmClient(ElasticsearchTransport transport) {
super(transport, null);
}
public ElasticsearchSlmClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) {
super(transport, transportOptions);
}
@Override
public ElasticsearchSlmClient withTransportOptions(@Nullable TransportOptions transportOptions) {
return new ElasticsearchSlmClient(this.transport, transportOptions);
}
// ----- Endpoint: slm.delete_lifecycle
/**
* Deletes an existing snapshot lifecycle policy.
*
* @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 an existing snapshot lifecycle policy.
*
* @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: slm.execute_lifecycle
/**
* Immediately creates a snapshot according to the lifecycle policy, without
* waiting for the scheduled time.
*
* @see Documentation
* on elastic.co
*/
public ExecuteLifecycleResponse executeLifecycle(ExecuteLifecycleRequest request)
throws IOException, ElasticsearchException {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ExecuteLifecycleRequest._ENDPOINT;
return this.transport.performRequest(request, endpoint, this.transportOptions);
}
/**
* Immediately creates a snapshot according to the lifecycle policy, without
* waiting for the scheduled time.
*
* @param fn
* a function that initializes a builder to create the
* {@link ExecuteLifecycleRequest}
* @see Documentation
* on elastic.co
*/
public final ExecuteLifecycleResponse executeLifecycle(
Function> fn)
throws IOException, ElasticsearchException {
return executeLifecycle(fn.apply(new ExecuteLifecycleRequest.Builder()).build());
}
// ----- Endpoint: slm.execute_retention
/**
* Deletes any snapshots that are expired according to the policy's retention
* rules.
*
* @see Documentation
* on elastic.co
*/
public ExecuteRetentionResponse executeRetention() throws IOException, ElasticsearchException {
return this.transport.performRequest(ExecuteRetentionRequest._INSTANCE, ExecuteRetentionRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: slm.get_lifecycle
/**
* Retrieves one or more snapshot lifecycle policy definitions and information
* about the latest snapshot attempts.
*
* @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 one or more 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 GetLifecycleResponse getLifecycle(
Function> fn)
throws IOException, ElasticsearchException {
return getLifecycle(fn.apply(new GetLifecycleRequest.Builder()).build());
}
/**
* Retrieves one or more snapshot lifecycle policy definitions and information
* about the latest snapshot attempts.
*
* @see Documentation
* on elastic.co
*/
public GetLifecycleResponse getLifecycle() throws IOException, ElasticsearchException {
return this.transport.performRequest(new GetLifecycleRequest.Builder().build(), GetLifecycleRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: slm.get_stats
/**
* Returns global and policy-level statistics about actions taken by snapshot
* lifecycle management.
*
* @see Documentation
* on elastic.co
*/
public GetStatsResponse getStats() throws IOException, ElasticsearchException {
return this.transport.performRequest(GetStatsRequest._INSTANCE, GetStatsRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: slm.get_status
/**
* Retrieves the status of snapshot lifecycle management (SLM).
*
* @see Documentation
* on elastic.co
*/
public GetSlmStatusResponse getStatus() throws IOException, ElasticsearchException {
return this.transport.performRequest(GetSlmStatusRequest._INSTANCE, GetSlmStatusRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: slm.put_lifecycle
/**
* Creates or updates a snapshot lifecycle policy.
*
* @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 or updates a snapshot lifecycle policy.
*
* @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: slm.start
/**
* Turns on snapshot lifecycle management (SLM).
*
* @see Documentation
* on elastic.co
*/
public StartSlmResponse start() throws IOException, ElasticsearchException {
return this.transport.performRequest(StartSlmRequest._INSTANCE, StartSlmRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: slm.stop
/**
* Turns off snapshot lifecycle management (SLM).
*
* @see Documentation
* on elastic.co
*/
public StopSlmResponse stop() throws IOException, ElasticsearchException {
return this.transport.performRequest(StopSlmRequest._INSTANCE, StopSlmRequest._ENDPOINT, this.transportOptions);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy