65 lines
1.4 KiB
C#
65 lines
1.4 KiB
C#
using Salmon.Core;
|
|
using Salmon.Core.Cliff;
|
|
|
|
namespace Salmon.Model.Monitor;
|
|
|
|
public class Container
|
|
: Element
|
|
{
|
|
[PersistentField]
|
|
public bool? Joinable { get; set; }
|
|
|
|
[PersistentField]
|
|
public bool? Running { get; set; }
|
|
|
|
[PersistentField]
|
|
public string? ContainerId { get; set; }
|
|
|
|
[PersistentField]
|
|
public string? Image { get; set; }
|
|
|
|
[PersistentField]
|
|
public string? ImageId { get; set; }
|
|
|
|
[PersistentField]
|
|
public string? ContainerStatus { get; set; }
|
|
|
|
public bool Ok {
|
|
get
|
|
{
|
|
return Joinable == true && Running == true;
|
|
}
|
|
}
|
|
|
|
protected Container()
|
|
{
|
|
|
|
}
|
|
|
|
public Container(string id)
|
|
: base(id)
|
|
{
|
|
|
|
}
|
|
|
|
public override IEnumerable<KeyValuePair<string, object>> ImportantProperties()
|
|
{
|
|
foreach (var i in base.ImportantProperties())
|
|
yield return new KeyValuePair<string, object>(i.Key, i.Value);
|
|
|
|
yield return new KeyValuePair<string, object>(nameof(Ok), Ok);
|
|
|
|
if (ContainerId is not null)
|
|
yield return new KeyValuePair<string, object>(nameof(ContainerId), ContainerId);
|
|
|
|
if (Image is not null)
|
|
yield return new KeyValuePair<string, object>(nameof(Image), Image);
|
|
|
|
if (ContainerStatus is not null)
|
|
yield return new KeyValuePair<string, object>(nameof(ContainerStatus), ContainerStatus);
|
|
|
|
|
|
}
|
|
|
|
}
|