refactor: reorganize Kubernetes client models into separate files (#1663)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
// See https://aka.ms/new-console-template for more information
|
// See https://aka.ms/new-console-template for more information
|
||||||
using k8s;
|
using k8s;
|
||||||
using k8s.ClientSets;
|
using k8s.ClientSets;
|
||||||
|
using k8s.Models;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace clientset
|
namespace clientset
|
||||||
|
|||||||
@@ -20,14 +20,14 @@
|
|||||||
<Compile Include="..\KubernetesClient\Extensions.cs" />
|
<Compile Include="..\KubernetesClient\Extensions.cs" />
|
||||||
<Compile Include="..\KubernetesClient\FloatEmitter.cs" />
|
<Compile Include="..\KubernetesClient\FloatEmitter.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\GeneratedModelVersion.cs" />
|
<Compile Include="..\KubernetesClient\Models\GeneratedModelVersion.cs" />
|
||||||
<Compile Include="..\KubernetesClient\IItems.cs" />
|
<Compile Include="..\KubernetesClient\Models\IItems.cs" />
|
||||||
<Compile Include="..\KubernetesClient\IKubernetesObject.cs" />
|
<Compile Include="..\KubernetesClient\IKubernetesObject.cs" />
|
||||||
<Compile Include="..\KubernetesClient\IMetadata.cs" />
|
<Compile Include="..\KubernetesClient\Models\IMetadata.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\IntOrStringJsonConverter.cs" />
|
<Compile Include="..\KubernetesClient\Models\IntOrStringJsonConverter.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\IntOrStringYamlConverter.cs" />
|
<Compile Include="..\KubernetesClient\Models\IntOrStringYamlConverter.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\IntstrIntOrString.cs" />
|
<Compile Include="..\KubernetesClient\Models\IntstrIntOrString.cs" />
|
||||||
<Compile Include="..\KubernetesClient\ISpec.cs" />
|
<Compile Include="..\KubernetesClient\Models\ISpec.cs" />
|
||||||
<Compile Include="..\KubernetesClient\IStatus.cs" />
|
<Compile Include="..\KubernetesClient\Models\IStatus.cs" />
|
||||||
<Compile Include="..\KubernetesClient\IValidate.cs" />
|
<Compile Include="..\KubernetesClient\IValidate.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\KubernetesEntityAttribute.cs" />
|
<Compile Include="..\KubernetesClient\Models\KubernetesEntityAttribute.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\KubernetesList.cs" />
|
<Compile Include="..\KubernetesClient\Models\KubernetesList.cs" />
|
||||||
|
|||||||
@@ -22,14 +22,14 @@
|
|||||||
<Compile Include="..\KubernetesClient\Extensions.cs" />
|
<Compile Include="..\KubernetesClient\Extensions.cs" />
|
||||||
<Compile Include="..\KubernetesClient\FloatEmitter.cs" />
|
<Compile Include="..\KubernetesClient\FloatEmitter.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\GeneratedModelVersion.cs" />
|
<Compile Include="..\KubernetesClient\Models\GeneratedModelVersion.cs" />
|
||||||
<Compile Include="..\KubernetesClient\IItems.cs" />
|
<Compile Include="..\KubernetesClient\Models\IItems.cs" />
|
||||||
<Compile Include="..\KubernetesClient\IKubernetesObject.cs" />
|
<Compile Include="..\KubernetesClient\IKubernetesObject.cs" />
|
||||||
<Compile Include="..\KubernetesClient\IMetadata.cs" />
|
<Compile Include="..\KubernetesClient\Models\IMetadata.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\IntOrStringJsonConverter.cs" />
|
<Compile Include="..\KubernetesClient\Models\IntOrStringJsonConverter.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\IntOrStringYamlConverter.cs" />
|
<Compile Include="..\KubernetesClient\Models\IntOrStringYamlConverter.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\IntstrIntOrString.cs" />
|
<Compile Include="..\KubernetesClient\Models\IntstrIntOrString.cs" />
|
||||||
<Compile Include="..\KubernetesClient\ISpec.cs" />
|
<Compile Include="..\KubernetesClient\Models\ISpec.cs" />
|
||||||
<Compile Include="..\KubernetesClient\IStatus.cs" />
|
<Compile Include="..\KubernetesClient\Models\IStatus.cs" />
|
||||||
<Compile Include="..\KubernetesClient\IValidate.cs" />
|
<Compile Include="..\KubernetesClient\IValidate.cs" />
|
||||||
<Compile Include="..\KubernetesClient\Models\KubernetesEntityAttribute.cs" />
|
<Compile Include="..\KubernetesClient\Models\KubernetesEntityAttribute.cs" />
|
||||||
<Compile Include="..\KubernetesClient\KubernetesJson.cs" />
|
<Compile Include="..\KubernetesClient\KubernetesJson.cs" />
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
namespace k8s
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Kubernetes object that exposes list of objects
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">type of the objects</typeparam>
|
|
||||||
public interface IItems<T>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets list of objects. More info:
|
|
||||||
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md
|
|
||||||
/// </summary>
|
|
||||||
IList<T> Items { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ItemsExt
|
|
||||||
{
|
|
||||||
public static IEnumerator<T> GetEnumerator<T>(this IItems<T> items)
|
|
||||||
{
|
|
||||||
if (items is null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(items));
|
|
||||||
}
|
|
||||||
|
|
||||||
return items.Items.GetEnumerator();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
namespace k8s
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Kubernetes object that exposes metadata
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">Type of metadata exposed. Usually this will be either
|
|
||||||
/// <see cref="V1ListMeta"/> for lists or <see cref="V1ObjectMeta"/> for objects</typeparam>
|
|
||||||
public interface IMetadata<T>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets standard object's metadata. More info:
|
|
||||||
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
|
||||||
/// </summary>
|
|
||||||
T Metadata { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
namespace k8s
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a Kubernetes object that has a spec
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">type of Kubernetes object</typeparam>
|
|
||||||
public interface ISpec<T>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets specification of the desired behavior of the entity. More
|
|
||||||
/// info:
|
|
||||||
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
|
||||||
/// </summary>
|
|
||||||
T Spec { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
27
src/KubernetesClient/Models/IItems.cs
Normal file
27
src/KubernetesClient/Models/IItems.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
namespace k8s.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Kubernetes object that exposes list of objects
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">type of the objects</typeparam>
|
||||||
|
public interface IItems<T>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets list of objects. More info:
|
||||||
|
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md
|
||||||
|
/// </summary>
|
||||||
|
IList<T> Items { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ItemsExt
|
||||||
|
{
|
||||||
|
public static IEnumerator<T> GetEnumerator<T>(this IItems<T> items)
|
||||||
|
{
|
||||||
|
if (items is null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(items));
|
||||||
|
}
|
||||||
|
|
||||||
|
return items.Items.GetEnumerator();
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/KubernetesClient/Models/IMetadata.cs
Normal file
15
src/KubernetesClient/Models/IMetadata.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace k8s.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Kubernetes object that exposes metadata
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Type of metadata exposed. Usually this will be either
|
||||||
|
/// <see cref="V1ListMeta"/> for lists or <see cref="V1ObjectMeta"/> for objects</typeparam>
|
||||||
|
public interface IMetadata<T>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets standard object's metadata. More info:
|
||||||
|
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
|
/// </summary>
|
||||||
|
T Metadata { get; set; }
|
||||||
|
}
|
||||||
15
src/KubernetesClient/Models/ISpec.cs
Normal file
15
src/KubernetesClient/Models/ISpec.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace k8s.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a Kubernetes object that has a spec
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">type of Kubernetes object</typeparam>
|
||||||
|
public interface ISpec<T>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets specification of the desired behavior of the entity. More
|
||||||
|
/// info:
|
||||||
|
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
|
/// </summary>
|
||||||
|
T Spec { get; set; }
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace k8s
|
namespace k8s.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kubernetes object that exposes status
|
/// Kubernetes object that exposes status
|
||||||
Reference in New Issue
Block a user