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

com.huaweicloud.sdk.csms.v1.model.UpdateSecretEventRequestBody Maven / Gradle / Ivy

There is a newer version: 3.1.114
Show newest version
package com.huaweicloud.sdk.csms.v1.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.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;

/**
 * 更新凭据事件通知请求体。
 */
public class UpdateSecretEventRequestBody {

    /**
     * 事件通知状态,取值如下。  ENABLED:表示启用状态 DISABLED:表示禁用状态 
     */
    public static final class StateEnum {

        /**
         * Enum ENABLED for value: "ENABLED"
         */
        public static final StateEnum ENABLED = new StateEnum("ENABLED");

        /**
         * Enum DISABLED for value: "DISABLED"
         */
        public static final StateEnum DISABLED = new StateEnum("DISABLED");

        private static final Map STATIC_FIELDS = createStaticFields();

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

        private String value;

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

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

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

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

        public static StateEnum 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 StateEnum) {
                return this.value.equals(((StateEnum) obj).value);
            }
            return false;
        }

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

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

    private StateEnum state;

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

    private List eventTypes = null;

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

    private Notification notification;

    public UpdateSecretEventRequestBody withState(StateEnum state) {
        this.state = state;
        return this;
    }

    /**
     * 事件通知状态,取值如下。  ENABLED:表示启用状态 DISABLED:表示禁用状态 
     * @return state
     */
    public StateEnum getState() {
        return state;
    }

    public void setState(StateEnum state) {
        this.state = state;
    }

    public UpdateSecretEventRequestBody withEventTypes(List eventTypes) {
        this.eventTypes = eventTypes;
        return this;
    }

    public UpdateSecretEventRequestBody addEventTypesItem(String eventTypesItem) {
        if (this.eventTypes == null) {
            this.eventTypes = new ArrayList<>();
        }
        this.eventTypes.add(eventTypesItem);
        return this;
    }

    public UpdateSecretEventRequestBody withEventTypes(Consumer> eventTypesSetter) {
        if (this.eventTypes == null) {
            this.eventTypes = new ArrayList<>();
        }
        eventTypesSetter.accept(this.eventTypes);
        return this;
    }

    /**
     * 本次事件通知的基础事件列表,基础事件类型如下。  SECRET_VERSION_CREATED:版本创建 SECRET_VERSION_EXPIRED:版本过期 SECRET_ROTATED:凭据轮转 SECRET_DELETED:凭据删除  列表包含的基础事件类型不能重复。 
     * @return eventTypes
     */
    public List getEventTypes() {
        return eventTypes;
    }

    public void setEventTypes(List eventTypes) {
        this.eventTypes = eventTypes;
    }

    public UpdateSecretEventRequestBody withNotification(Notification notification) {
        this.notification = notification;
        return this;
    }

    public UpdateSecretEventRequestBody withNotification(Consumer notificationSetter) {
        if (this.notification == null) {
            this.notification = new Notification();
            notificationSetter.accept(this.notification);
        }

        return this;
    }

    /**
     * Get notification
     * @return notification
     */
    public Notification getNotification() {
        return notification;
    }

    public void setNotification(Notification notification) {
        this.notification = notification;
    }

    @Override
    public boolean equals(java.lang.Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        UpdateSecretEventRequestBody that = (UpdateSecretEventRequestBody) obj;
        return Objects.equals(this.state, that.state) && Objects.equals(this.eventTypes, that.eventTypes)
            && Objects.equals(this.notification, that.notification);
    }

    @Override
    public int hashCode() {
        return Objects.hash(state, eventTypes, notification);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class UpdateSecretEventRequestBody {\n");
        sb.append("    state: ").append(toIndentedString(state)).append("\n");
        sb.append("    eventTypes: ").append(toIndentedString(eventTypes)).append("\n");
        sb.append("    notification: ").append(toIndentedString(notification)).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