org.elasticsearch.xpack.core.enrich.action.DeleteEnrichPolicyAction Maven / Gradle / Ivy
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.core.enrich.action;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.action.support.master.MasterNodeRequest;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
import java.util.Objects;
public class DeleteEnrichPolicyAction extends ActionType {
public static final DeleteEnrichPolicyAction INSTANCE = new DeleteEnrichPolicyAction();
public static final String NAME = "cluster:admin/xpack/enrich/delete";
private DeleteEnrichPolicyAction() {
super(NAME, AcknowledgedResponse::readFrom);
}
public static class Request extends MasterNodeRequest {
private final String name;
public Request(String name) {
this.name = Objects.requireNonNull(name, "name cannot be null");
}
public Request(StreamInput in) throws IOException {
super(in);
this.name = in.readString();
}
public String getName() {
return name;
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeString(name);
}
@Override
public ActionRequestValidationException validate() {
return null;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Request request = (Request) o;
return name.equals(request.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
}
}