Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

事件上报实体关系 #1104

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}