Files
csharp/examples/customResource/CustomResourceDefinition.cs
stan-sz 21c41e72eb Implement IMetadata interface (#998)
* V1PodTemplateSpec implements IMetadata interface

This will allow using the ModelExteions methods over V1PodTemplateSpec

* Typo
2022-09-12 00:47:24 -07:00

46 lines
1.4 KiB
C#

using k8s;
using k8s.Models;
using System.Collections.Generic;
using System.Text.Json.Serialization;
[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "CA1724:TypeNamesShouldNotMatchNamespaces", Justification = "This is just an example.")]
[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "This is just an example.")]
namespace customResource
{
public class CustomResourceDefinition
{
public string Version { get; set; }
public string Group { get; set; }
public string PluralName { get; set; }
public string Kind { get; set; }
public string Namespace { get; set; }
}
public abstract class CustomResource : KubernetesObject, IMetadata<V1ObjectMeta>
{
[JsonPropertyName("metadata")]
public V1ObjectMeta Metadata { get; set; }
}
public abstract class CustomResource<TSpec, TStatus> : CustomResource
{
[JsonPropertyName("spec")]
public TSpec Spec { get; set; }
[JsonPropertyName("CStatus")]
public TStatus CStatus { get; set; }
}
public class CustomResourceList<T> : KubernetesObject
where T : CustomResource
{
public V1ListMeta Metadata { get; set; }
public List<T> Items { get; set; }
}
}