Files
csharp/src/KubernetesClient/ModelExtensions.cs

21 lines
656 B
C#
Raw Normal View History

2020-04-20 09:37:39 -07:00
using System.Net;
namespace k8s.Models
{
public partial class V1Status
{
/// <summary>Converts a <see cref="V1Status"/> object into a short description of the status.</summary>
public override string ToString()
{
string reason = Reason;
if (string.IsNullOrEmpty(reason) && Code.GetValueOrDefault() != 0)
{
reason = ((HttpStatusCode)Code.Value).ToString();
}
2020-04-20 09:37:39 -07:00
return string.IsNullOrEmpty(Message) ? string.IsNullOrEmpty(reason) ? Status : reason :
string.IsNullOrEmpty(reason) ? Message : $"{reason} - {Message}";
2020-04-20 09:37:39 -07:00
}
}
}