Skip to content

Commit

Permalink
backend模块事件上报实体关系
Browse files Browse the repository at this point in the history
  • Loading branch information
xuezechao1 committed Mar 6, 2023
1 parent e999e47 commit 1d88fe3
Show file tree
Hide file tree
Showing 8 changed files with 367 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 1d88fe3

Please sign in to comment.