package com.microservices.mon.k8s.domain.vo;

import com.microservices.mon.k8s.domain.K8sApplicationAndPodState;
import lombok.Data;

@Data
public class RancherMetadataState {
    // 是否错误
    Boolean error;
    // 状态消息
    String message;
    // 状态名称
    // 应用状态(name -> active、name -> updating、name -> in-progress、name -> error)
    // pod状态（name -> imagePullBackOff、name -> containerCreating）
    String name;
    // 是否过渡状态
    Boolean transitioning;

    public K8sApplicationAndPodState toK8sApplicationState() {
        K8sApplicationAndPodState state = new K8sApplicationAndPodState();
        state.setName(name);
        state.setIsError(error);
        state.setMessage(message);
        state.setApplicationAliasByName(name);
        return state;
    }
    public K8sApplicationAndPodState toK8sPodState() {
        K8sApplicationAndPodState state = new K8sApplicationAndPodState();
        state.setName(name);
        state.setMessage(message);
        state.setPodAliasAndErrorByName(name);
        return state;
    }

}
