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

co.elastic.clients.elasticsearch.transform.ElasticsearchTransformClient Maven / Gradle / Ivy

There is a newer version: 8.17.0
Show 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.
 */

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package co.elastic.clients.elasticsearch.transform;

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.transport.endpoints.EndpointWithResponseMapperAttr;
import co.elastic.clients.util.ObjectBuilder;
import java.io.IOException;
import java.util.function.Function;
import javax.annotation.Nullable;

/**
 * Client for the transform namespace.
 */
public class ElasticsearchTransformClient extends ApiClient {

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

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

	@Override
	public ElasticsearchTransformClient withTransportOptions(@Nullable TransportOptions transportOptions) {
		return new ElasticsearchTransformClient(this.transport, transportOptions);
	}

	// ----- Endpoint: transform.delete_transform

	/**
	 * Deletes an existing transform.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public DeleteTransformResponse deleteTransform(DeleteTransformRequest request)
			throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) DeleteTransformRequest._ENDPOINT;

		return this.transport.performRequest(request, endpoint, this.transportOptions);
	}

	/**
	 * Deletes an existing transform.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link DeleteTransformRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final DeleteTransformResponse deleteTransform(
			Function> fn)
			throws IOException, ElasticsearchException {
		return deleteTransform(fn.apply(new DeleteTransformRequest.Builder()).build());
	}

	// ----- Endpoint: transform.get_transform

	/**
	 * Retrieves configuration information for transforms.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public GetTransformResponse getTransform(GetTransformRequest request) throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) GetTransformRequest._ENDPOINT;

		return this.transport.performRequest(request, endpoint, this.transportOptions);
	}

	/**
	 * Retrieves configuration information for transforms.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link GetTransformRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final GetTransformResponse getTransform(
			Function> fn)
			throws IOException, ElasticsearchException {
		return getTransform(fn.apply(new GetTransformRequest.Builder()).build());
	}

	/**
	 * Retrieves configuration information for transforms.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public GetTransformResponse getTransform() throws IOException, ElasticsearchException {
		return this.transport.performRequest(new GetTransformRequest.Builder().build(), GetTransformRequest._ENDPOINT,
				this.transportOptions);
	}

	// ----- Endpoint: transform.get_transform_stats

	/**
	 * Retrieves usage information for transforms.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public GetTransformStatsResponse getTransformStats(GetTransformStatsRequest request)
			throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) GetTransformStatsRequest._ENDPOINT;

		return this.transport.performRequest(request, endpoint, this.transportOptions);
	}

	/**
	 * Retrieves usage information for transforms.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link GetTransformStatsRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final GetTransformStatsResponse getTransformStats(
			Function> fn)
			throws IOException, ElasticsearchException {
		return getTransformStats(fn.apply(new GetTransformStatsRequest.Builder()).build());
	}

	// ----- Endpoint: transform.preview_transform

	/**
	 * Previews a transform.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  PreviewTransformResponse previewTransform(PreviewTransformRequest request,
			Class tTransformClass) throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) PreviewTransformRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:transform.preview_transform.TTransform",
				getDeserializer(tTransformClass));

		return this.transport.performRequest(request, endpoint, this.transportOptions);
	}

	/**
	 * Previews a transform.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link PreviewTransformRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final  PreviewTransformResponse previewTransform(
			Function> fn,
			Class tTransformClass) throws IOException, ElasticsearchException {
		return previewTransform(fn.apply(new PreviewTransformRequest.Builder()).build(), tTransformClass);
	}

	// ----- Endpoint: transform.put_transform

	/**
	 * Instantiates a transform.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public PutTransformResponse putTransform(PutTransformRequest request) throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) PutTransformRequest._ENDPOINT;

		return this.transport.performRequest(request, endpoint, this.transportOptions);
	}

	/**
	 * Instantiates a transform.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link PutTransformRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final PutTransformResponse putTransform(
			Function> fn)
			throws IOException, ElasticsearchException {
		return putTransform(fn.apply(new PutTransformRequest.Builder()).build());
	}

	// ----- Endpoint: transform.reset_transform

	/**
	 * Resets an existing transform.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public ResetTransformResponse resetTransform(ResetTransformRequest request)
			throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) ResetTransformRequest._ENDPOINT;

		return this.transport.performRequest(request, endpoint, this.transportOptions);
	}

	/**
	 * Resets an existing transform.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link ResetTransformRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final ResetTransformResponse resetTransform(
			Function> fn)
			throws IOException, ElasticsearchException {
		return resetTransform(fn.apply(new ResetTransformRequest.Builder()).build());
	}

	// ----- Endpoint: transform.start_transform

	/**
	 * Starts one or more transforms.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public StartTransformResponse startTransform(StartTransformRequest request)
			throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) StartTransformRequest._ENDPOINT;

		return this.transport.performRequest(request, endpoint, this.transportOptions);
	}

	/**
	 * Starts one or more transforms.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link StartTransformRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final StartTransformResponse startTransform(
			Function> fn)
			throws IOException, ElasticsearchException {
		return startTransform(fn.apply(new StartTransformRequest.Builder()).build());
	}

	// ----- Endpoint: transform.stop_transform

	/**
	 * Stops one or more transforms.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public StopTransformResponse stopTransform(StopTransformRequest request)
			throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) StopTransformRequest._ENDPOINT;

		return this.transport.performRequest(request, endpoint, this.transportOptions);
	}

	/**
	 * Stops one or more transforms.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link StopTransformRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final StopTransformResponse stopTransform(
			Function> fn)
			throws IOException, ElasticsearchException {
		return stopTransform(fn.apply(new StopTransformRequest.Builder()).build());
	}

	// ----- Endpoint: transform.update_transform

	/**
	 * Updates certain properties of a transform.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public UpdateTransformResponse updateTransform(UpdateTransformRequest request)
			throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) UpdateTransformRequest._ENDPOINT;

		return this.transport.performRequest(request, endpoint, this.transportOptions);
	}

	/**
	 * Updates certain properties of a transform.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link UpdateTransformRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final UpdateTransformResponse updateTransform(
			Function> fn)
			throws IOException, ElasticsearchException {
		return updateTransform(fn.apply(new UpdateTransformRequest.Builder()).build());
	}

	// ----- Endpoint: transform.upgrade_transforms

	/**
	 * Upgrades all transforms.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public UpgradeTransformsResponse upgradeTransforms(UpgradeTransformsRequest request)
			throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) UpgradeTransformsRequest._ENDPOINT;

		return this.transport.performRequest(request, endpoint, this.transportOptions);
	}

	/**
	 * Upgrades all transforms.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link UpgradeTransformsRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final UpgradeTransformsResponse upgradeTransforms(
			Function> fn)
			throws IOException, ElasticsearchException {
		return upgradeTransforms(fn.apply(new UpgradeTransformsRequest.Builder()).build());
	}

	/**
	 * Upgrades all transforms.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public UpgradeTransformsResponse upgradeTransforms() throws IOException, ElasticsearchException {
		return this.transport.performRequest(new UpgradeTransformsRequest.Builder().build(),
				UpgradeTransformsRequest._ENDPOINT, this.transportOptions);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy