Update customResource example nuget packages + update example Update httpClientFactory example nuget packages Update nuget packages Change DateTime to DateTimeOffset Update tests nuget packages Make KubernetesClient project reference instead of Nuget package reference Co-authored-by: Boshi Lian <farmer1992@gmail.com> Co-authored-by: Boshi Lian <farmer1992@gmail.com>
34 lines
869 B
C#
34 lines
869 B
C#
using k8s.Models;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace customResource
|
|
{
|
|
public class CResource : CustomResource<CResourceSpec, CResourceStatus>
|
|
{
|
|
public override string ToString()
|
|
{
|
|
var labels = "{";
|
|
foreach (var kvp in Metadata.Labels)
|
|
{
|
|
labels += kvp.Key + " : " + kvp.Value + ", ";
|
|
}
|
|
|
|
labels = labels.TrimEnd(',', ' ') + "}";
|
|
|
|
return $"{Metadata.Name} (Labels: {labels}), Spec: {Spec.CityName}";
|
|
}
|
|
}
|
|
|
|
public class CResourceSpec
|
|
{
|
|
[JsonProperty(PropertyName = "cityName")]
|
|
public string CityName { get; set; }
|
|
}
|
|
|
|
public class CResourceStatus : V1Status
|
|
{
|
|
[JsonProperty(PropertyName = "temperature", NullValueHandling = NullValueHandling.Ignore)]
|
|
public string Temperature { get; set; }
|
|
}
|
|
}
|