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

com.huaweicloud.sdk.aom.v2.model.PushEventsRequest Maven / Gradle / Ivy

There is a newer version: 3.1.114
Show newest version
package com.huaweicloud.sdk.aom.v2.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;

/**
 * Request Object
 */
public class PushEventsRequest {

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "x-enterprise-prject-id")

    private String xEnterprisePrjectId;

    /**
     * 接口请求动作。action=clear代表清除告警,不传或者传其他值默认为上报动作。
     */
    public static final class ActionEnum {

        /**
         * Enum CLEAR for value: "clear"
         */
        public static final ActionEnum CLEAR = new ActionEnum("clear");

        private static final Map STATIC_FIELDS = createStaticFields();

        private static Map createStaticFields() {
            Map map = new HashMap<>();
            map.put("clear", CLEAR);
            return Collections.unmodifiableMap(map);
        }

        private String value;

        ActionEnum(String value) {
            this.value = value;
        }

        @JsonValue
        public String getValue() {
            return value;
        }

        @Override
        public String toString() {
            return String.valueOf(value);
        }

        @JsonCreator
        public static ActionEnum fromValue(String value) {
            if (value == null) {
                return null;
            }
            return java.util.Optional.ofNullable(STATIC_FIELDS.get(value)).orElse(new ActionEnum(value));
        }

        public static ActionEnum valueOf(String value) {
            if (value == null) {
                return null;
            }
            return java.util.Optional.ofNullable(STATIC_FIELDS.get(value))
                .orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
        }

        @Override
        public boolean equals(Object obj) {
            if (obj instanceof ActionEnum) {
                return this.value.equals(((ActionEnum) obj).value);
            }
            return false;
        }

        @Override
        public int hashCode() {
            return this.value.hashCode();
        }
    }

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "action")

    private ActionEnum action;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "body")

    private EventList body;

    public PushEventsRequest withXEnterprisePrjectId(String xEnterprisePrjectId) {
        this.xEnterprisePrjectId = xEnterprisePrjectId;
        return this;
    }

    /**
     * 告警所属的企业项目id。
     * @return xEnterprisePrjectId
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "x-enterprise-prject-id")
    public String getXEnterprisePrjectId() {
        return xEnterprisePrjectId;
    }

    public void setXEnterprisePrjectId(String xEnterprisePrjectId) {
        this.xEnterprisePrjectId = xEnterprisePrjectId;
    }

    public PushEventsRequest withAction(ActionEnum action) {
        this.action = action;
        return this;
    }

    /**
     * 接口请求动作。action=clear代表清除告警,不传或者传其他值默认为上报动作。
     * @return action
     */
    public ActionEnum getAction() {
        return action;
    }

    public void setAction(ActionEnum action) {
        this.action = action;
    }

    public PushEventsRequest withBody(EventList body) {
        this.body = body;
        return this;
    }

    public PushEventsRequest withBody(Consumer bodySetter) {
        if (this.body == null) {
            this.body = new EventList();
            bodySetter.accept(this.body);
        }

        return this;
    }

    /**
     * Get body
     * @return body
     */
    public EventList getBody() {
        return body;
    }

    public void setBody(EventList body) {
        this.body = body;
    }

    @Override
    public boolean equals(java.lang.Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        PushEventsRequest that = (PushEventsRequest) obj;
        return Objects.equals(this.xEnterprisePrjectId, that.xEnterprisePrjectId)
            && Objects.equals(this.action, that.action) && Objects.equals(this.body, that.body);
    }

    @Override
    public int hashCode() {
        return Objects.hash(xEnterprisePrjectId, action, body);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class PushEventsRequest {\n");
        sb.append("    xEnterprisePrjectId: ").append(toIndentedString(xEnterprisePrjectId)).append("\n");
        sb.append("    action: ").append(toIndentedString(action)).append("\n");
        sb.append("    body: ").append(toIndentedString(body)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(java.lang.Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy