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

com.huaweicloud.sdk.csms.v1.model.CreateSecretEventRequestBody 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 CreateSecretEventRequestBody {

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

    private String name;

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

    private List eventTypes = null;

    /**
     * 控制事件是否生效,只有启用状态才能触发包含的基础事件类型  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 = "notification")

    private Notification notification;

    public CreateSecretEventRequestBody withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * 新创建事件通知的名称。  约束:取值范围为1到64个字符,满足正则匹配“^[a-zA-Z0-9_-]{1,64}$”。 
     * @return name
     */
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

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

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

    public CreateSecretEventRequestBody 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 CreateSecretEventRequestBody 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 CreateSecretEventRequestBody withNotification(Notification notification) {
        this.notification = notification;
        return this;
    }

    public CreateSecretEventRequestBody 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;
        }
        CreateSecretEventRequestBody that = (CreateSecretEventRequestBody) obj;
        return Objects.equals(this.name, that.name) && Objects.equals(this.eventTypes, that.eventTypes)
            && Objects.equals(this.state, that.state) && Objects.equals(this.notification, that.notification);
    }

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

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