diff --git a/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/ClusterEntity.java b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/ClusterEntity.java new file mode 100644 index 0000000000..bbad3d2bbd --- /dev/null +++ b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/ClusterEntity.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huaweicloud.sermant.backend.entity; + +import lombok.Getter; +import lombok.Setter; + +/** + * 集群实体 + * + * @author xuezechao + * @since 2023-03-02 + */ +@Getter +@Setter +public class ClusterEntity { + String cluster; +} diff --git a/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EnvironmentEntity.java b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EnvironmentEntity.java new file mode 100644 index 0000000000..6f94e793d4 --- /dev/null +++ b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EnvironmentEntity.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huaweicloud.sermant.backend.entity; + +import lombok.Getter; +import lombok.Setter; + +/** + * 环境实体 + * + * @author xuezechao + * @since 2023-03-02 + */ +@Getter +@Setter +public class EnvironmentEntity { + String env; +} diff --git a/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventInfoEntity.java b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventInfoEntity.java new file mode 100644 index 0000000000..0d2ea306a5 --- /dev/null +++ b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventInfoEntity.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huaweicloud.sermant.backend.entity; + +import lombok.Getter; +import lombok.Setter; + +/** + * 事件实体 + * + * @since 2023-03-02 + * @author xuezechao + */ +@Getter +@Setter +public class EventInfoEntity { + /** + * 实例元数据hash + */ + private String meta; + + /** + * 触发时间 + */ + private long time; + + /** + * 事件区域 + */ + private String scope; + + /** + * 事件等级 + */ + private EventLevel level; + + /** + * 事件类型 + */ + private EventType type; + + /** + * 事件信息 + */ + private EventMessageEntity info; +} diff --git a/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventLevel.java b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventLevel.java new file mode 100644 index 0000000000..d6a81036a5 --- /dev/null +++ b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventLevel.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huaweicloud.sermant.backend.entity; + +/** + * 事件等级 + * + * @author xuezechao + * @since 2023-03-02 + */ +public enum EventLevel { + + /** + * 紧急 + */ + EMERGENCY(300), + + /** + * 重要 + */ + IMPORTANT(200), + + /** + * 一般 + */ + NORMAL(100); + + private final int levelThreshold; + + EventLevel(int levelThreshold) { + this.levelThreshold = levelThreshold; + } + + public int getLevelThreshold() { + return levelThreshold; + } +} diff --git a/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventMessageEntity.java b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventMessageEntity.java new file mode 100644 index 0000000000..0f35164896 --- /dev/null +++ b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventMessageEntity.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huaweicloud.sermant.backend.entity; + +import lombok.Getter; +import lombok.Setter; + +/** + * 事件信息 + * + * @author xuezechao + * @since 2023-03-02 + */ +@Getter +@Setter +public class EventMessageEntity { + private String name; + private String description; +} diff --git a/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventType.java b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventType.java new file mode 100644 index 0000000000..f145eab518 --- /dev/null +++ b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/EventType.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huaweicloud.sermant.backend.entity; + +/** + * 事件类型 + * + * @author xuezechao + * @since 2023-03-02 + */ +public enum EventType { + /** + * 运行事件 + */ + OPERATION(0, "operation"), + + /** + * 治理事件 + */ + GOVERNANCE(1, "governance"), + + /** + * 日志事件 + */ + LOG(2, "log"); + + private final int type; + + private final String description; + + EventType(int type, String description) { + this.type = type; + this.description = description; + } + + public int getType() { + return type; + } + + public String getDescription() { + return description; + } +} diff --git a/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/InstanceMeta.java b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/InstanceMeta.java new file mode 100644 index 0000000000..a21ad06766 --- /dev/null +++ b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/InstanceMeta.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huaweicloud.sermant.backend.entity; + +import lombok.Getter; +import lombok.Setter; + +/** + * 事件元数据 + * + * @author xuezechao + * @since 2023-03-02 + */ +@Getter +@Setter +public class InstanceMeta { + + /** + * 实例原数据哈希 + */ + private String metaHash; + + /** + * 实例ID + */ + private String instanceId; + + /** + * 应用 + */ + private String application; + + /** + * 节点 + */ + private NodeEntity node; + + /** + * 集群 + */ + private ClusterEntity cluster; + + /** + * 环境 + */ + private EnvironmentEntity environment; + + /** + * 可用区 + */ + private String az; +} diff --git a/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/NodeEntity.java b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/NodeEntity.java new file mode 100644 index 0000000000..d5c9b3b5b3 --- /dev/null +++ b/sermant-backend/src/main/java/com/huaweicloud/sermant/backend/entity/NodeEntity.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.huaweicloud.sermant.backend.entity; + +import lombok.Getter; +import lombok.Setter; + +/** + * 实例节点数据 + * + * @author xuezechao + * @since 2023-03-02 + */ +@Getter +@Setter +public class NodeEntity { + + /** + * 实例ip + */ + private String ip; +}