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

org.elasticsearch.client.ml.StopDataFrameAnalyticsResponse Maven / Gradle / Ivy

There is a newer version: 8.0.0-alpha2
Show newest version
/*
 * 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 and the Server Side Public License, v 1; you may not use this file except
 * in compliance with, at your election, the Elastic License 2.0 or the Server
 * Side Public License, v 1.
 */
package org.elasticsearch.client.ml;

import org.elasticsearch.xcontent.ConstructingObjectParser;
import org.elasticsearch.xcontent.ParseField;
import org.elasticsearch.xcontent.ToXContentObject;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentParser;

import java.io.IOException;
import java.util.Objects;

/**
 * Response indicating if the Machine Learning Data Frame Analytics is now stopped or not
 */
public class StopDataFrameAnalyticsResponse implements ToXContentObject {

    private static final ParseField STOPPED = new ParseField("stopped");

    public static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
        "stop_data_frame_analytics_response",
        true,
        args -> new StopDataFrameAnalyticsResponse((Boolean) args[0])
    );

    static {
        PARSER.declareBoolean(ConstructingObjectParser.constructorArg(), STOPPED);
    }

    public static StopDataFrameAnalyticsResponse fromXContent(XContentParser parser) throws IOException {
        return PARSER.parse(parser, null);
    }

    private final boolean stopped;

    public StopDataFrameAnalyticsResponse(boolean stopped) {
        this.stopped = stopped;
    }

    /**
     * Has the Data Frame Analytics stopped or not
     *
     * @return boolean value indicating the Data Frame Analytics stopped status
     */
    public boolean isStopped() {
        return stopped;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        StopDataFrameAnalyticsResponse other = (StopDataFrameAnalyticsResponse) o;
        return stopped == other.stopped;
    }

    @Override
    public int hashCode() {
        return Objects.hash(stopped);
    }

    @Override
    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
        return builder.startObject().field(STOPPED.getPreferredName(), stopped).endObject();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy