# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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.

import warnings

from tencentcloud.common.abstract_model import AbstractModel


class AbnormalProcessChildRuleInfo(AbstractModel):
    """容器运行时安全，子策略信息

    """

    def __init__(self):
        r"""
        :param RuleMode: 策略模式，   RULE_MODE_RELEASE: 放行
   RULE_MODE_ALERT: 告警
   RULE_MODE_HOLDUP:拦截
        :type RuleMode: str
        :param ProcessPath: 进程路径
        :type ProcessPath: str
        :param RuleId: 子策略id
注意：此字段可能返回 null，表示取不到有效值。
        :type RuleId: str
        """
        self.RuleMode = None
        self.ProcessPath = None
        self.RuleId = None


    def _deserialize(self, params):
        self.RuleMode = params.get("RuleMode")
        self.ProcessPath = params.get("ProcessPath")
        self.RuleId = params.get("RuleId")
        memeber_set = set(params.keys())
        for name, value in vars(self).items():
            if name in memeber_set:
                memeber_set.remove(name)
        if len(memeber_set) > 0:
            warnings.warn("%s fileds are useless." % ",".join(memeber_set))
        


class AbnormalProcessEventDescription(AbstractModel):
    """运行时容器访问控制事件描述信息

    """

    def __init__(self):
        r"""
        :param Description: 事件规则
        :type Description: str
        :param Solution: 解决方案
        :type Solution: str
        :param Remark: 事件备注信息
注意：此字段可能返回 null，表示取不到有效值。
        :type Remark: str
        :param MatchRule: 命中规则详细信息
        :type MatchRule: :class:`tencentcloud.tcss.v20201101.models.AbnormalProcessChildRuleInfo`
        :param RuleName: 命中规则名字
        :type RuleName: str
        :param RuleId: 命中规则的id
        :type RuleId: str
        """
        self.Description = None
        self.Solution = None
        self.Remark = None
        self.MatchRule = None
        self.RuleName = None
        self.RuleId = None


    def _deserialize(self, params):
        self.Description = params.get("Description")
        self.Solution = params.get("Solution")
        self.Remark = params.get("Remark")
        if params.get("MatchRule") is not None:
            self.MatchRule = AbnormalProcessChildRuleInfo()
            self.MatchRule._deserialize(params.get("MatchRule"))
        self.RuleName = params.get("RuleName")
        self.RuleId = params.get("RuleId")
        memeber_set = set(params.keys())
        for name, value in vars(self).items():
            if name in memeber_set:
                memeber_set.remove(name)
        if len(memeber_set) > 0:
            warnings.warn("%s fileds are useless." % ",".join(memeber_set))
        


class AbnormalProcessEventInfo(AbstractModel):
    """容器运行时安全异常进程信息

    """

    def __init__(self):
        r"""
        :param ProcessPath: 进程目录
        :type ProcessPath: str
        :param EventType: 事件类型，MALICE_PROCESS_START:恶意进程启动
        :type EventType: str
        :param MatchRuleName: 命中规则
        :type MatchRuleName: str
        :param FoundTime: 生成时间
        :type FoundTime: str
        :param ContainerName: 容器名
        :type ContainerName: str
        :param ImageName: 镜像名
        :type ImageName: str
        :param Behavior: 动作执行结果，    BEHAVIOR_NONE: 无
    BEHAVIOR_ALERT: 告警
    BEHAVIOR_RELEASE：放行
    BEHAVIOR_HOLDUP_FAILED:拦截失败
    BEHAVIOR_HOLDUP_SUCCESSED：拦截失败
        :type Behavior: str
        :param Status: 状态，EVENT_UNDEAL:事件未处理
    EVENT_DEALED:事件已经处理
    EVENT_INGNORE：事件已经忽略
        :type Status: str
        :param Id: 事件记录的唯一id
        :type Id: str
        :param ImageId: 镜像id，用于跳转
        :type ImageId: str
        :param ContainerId: 容器id，用于跳转
        :type ContainerId: str
        :param Solution: 事件解决方案
        :type Solution: str
        :param Description: 事件详细描述
        :type Description: str
        :param MatchRuleId: 命中策略id
        :type MatchRuleId: str
        :param MatchAction: 命中规则行为：
RULE_MODE_RELEASE 放行
RULE_MODE_ALERT  告警
RULE_MODE_HOLDUP 拦截
        :type MatchAction: str
        :param MatchProcessPath: 命中规则进程信息
        :type MatchProcessPath: str
        :param RuleExist: 规则是否存在
        :type RuleExist: bool
        :param EventCount: 事件数量
        :type EventCount: int
        :param LatestFoundTime: 最近生成时间
        :type LatestFoundTime: str
        :param RuleId: 规则组Id
        :type RuleId: str
        """
        self.ProcessPath = None
        self.EventType = None
        self.MatchRuleName = None
        self.FoundTime = None
        self.ContainerName = None
        self.ImageName = None
        self.Behavior = None
        self.Status = None
        self.Id = None
        self.ImageId = None
        self.ContainerId = None
        self.Solution = None
        self.Description = None
        self.MatchRuleId = None
        self.MatchAction = None
        self.MatchProcessPath = None
        self.RuleExist = None
        self.EventCount = None
        self.LatestFoundTime = None
        self.RuleId = None


    def _deserialize(self, params):
        self.ProcessPath = params.get("ProcessPath")
        self.EventType = params.get("EventType")
        self.MatchRuleName = params.get("MatchRuleName")
        self.FoundTime = params.get("FoundTime")
        self.ContainerName = params.get("ContainerName")
        self.ImageName = params.get("ImageName")
        self.Behavior = params.get("Behavior")
        self.Status = params.get("Status")
        self.Id = params.get("Id")
        self.ImageId = params.get("ImageId")
        self.ContainerId = params.get("ContainerId")
        self.Solution = params.get("Solution")
        self.Description = params.get("Description")
        self.MatchRuleId = params.get("MatchRuleId")
        self.MatchAction = params.get("MatchAction")
        self.MatchProcessPath = params.get("MatchProcessPath")
        self.RuleExist = params.get("RuleExist")
        self.EventCount = params.get("EventCount")
        self.LatestFoundTime = params.get("LatestFoundTime")
        self.RuleId = params.get("RuleId")
        memeber_set = set(params.keys())
        for name, value in vars(self).items():
            if name in memeber_set:
                memeber_set.remove(name)
        if len(memeber_set) > 0:
            warnings.warn("%s fileds are useless." % ",".join(memeber_set))
        


class AbnormalProcessRuleInfo(AbstractModel):
    """运行时安全，异常进程检测策略

    """

    def __init__(self):
        r"""
        :param IsEnable: true:策略启用，false:策略禁用
        :type IsEnable: bool
        :param ImageIds: 生效镜像id，空数组代表全部镜像
        :type ImageIds: list of str
        :param ChildRules
: 用户策略的子策略数组
        :type ChildRules: list of AbnormalProcessChildRuleInfo
        :param RuleName: 策略名字
        :type RuleName: str
        :param RuleId: 策略id
注意：此字段可能返回 null，表示取不到有效值。
        :type RuleId: str
        :param SystemChildRules: 系统策略的子策略数组
        :type SystemChildRules: list of AbnormalProcessSy
stemChildRuleInfo
        """
        self.IsEnable = None
        self.ImageIds = None
        self.ChildRules = None
        self.RuleName = None
        self.RuleId = None
        self.SystemChildRules = None


    def _deserialize(self, params):
        self.IsEnable = params.get("IsEnable")
        self.ImageIds = params.get("ImageIds")
        if params.get("ChildRules") is not None:
            self.ChildRules = []
            for item in params.get("ChildRules"):
                obj = AbnormalProcessChildRuleInfo()
                obj._deserialize(item)
                self.ChildRules.append(obj)
        self.RuleName = params.get("RuleName")
        self.RuleId = params.get("RuleId")
        if params.get("SystemChildRules") is not None:
  