Skip to content

Commit cfae034

Browse files
authored
Merge branch 'master' into record
2 parents 0304920 + 11a9641 commit cfae034

File tree

10 files changed

+70
-70
lines changed

10 files changed

+70
-70
lines changed

examples/clientset/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// See https://aka.ms/new-console-template for more information
1+
// See https://aka.ms/new-console-template for more information
22
using k8s;
33
using k8s.ClientSets;
4+
using k8s.Models;
45
using System.Threading.Tasks;
56

67
namespace clientset

src/KubernetesClient.Aot/KubernetesClient.Aot.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
<Compile Include="..\KubernetesClient\Extensions.cs" />
2121
<Compile Include="..\KubernetesClient\FloatEmitter.cs" />
2222
<Compile Include="..\KubernetesClient\Models\GeneratedModelVersion.cs" />
23-
<Compile Include="..\KubernetesClient\IItems.cs" />
23+
<Compile Include="..\KubernetesClient\Models\IItems.cs" />
2424
<Compile Include="..\KubernetesClient\IKubernetesObject.cs" />
25-
<Compile Include="..\KubernetesClient\IMetadata.cs" />
25+
<Compile Include="..\KubernetesClient\Models\IMetadata.cs" />
2626
<Compile Include="..\KubernetesClient\Models\IntOrStringJsonConverter.cs" />
2727
<Compile Include="..\KubernetesClient\Models\IntOrStringYamlConverter.cs" />
2828
<Compile Include="..\KubernetesClient\Models\IntOrString.cs" />
29-
<Compile Include="..\KubernetesClient\ISpec.cs" />
30-
<Compile Include="..\KubernetesClient\IStatus.cs" />
29+
<Compile Include="..\KubernetesClient\Models\ISpec.cs" />
30+
<Compile Include="..\KubernetesClient\Models\IStatus.cs" />
31+
<Compile Include="..\KubernetesClient\IValidate.cs" />
3132
<Compile Include="..\KubernetesClient\Models\KubernetesEntityAttribute.cs" />
3233
<Compile Include="..\KubernetesClient\Models\KubernetesList.cs" />
3334
<Compile Include="..\KubernetesClient\KubernetesObject.cs" />

src/KubernetesClient.Classic/KubernetesClient.Classic.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222
<Compile Include="..\KubernetesClient\Extensions.cs" />
2323
<Compile Include="..\KubernetesClient\FloatEmitter.cs" />
2424
<Compile Include="..\KubernetesClient\Models\GeneratedModelVersion.cs" />
25-
<Compile Include="..\KubernetesClient\IItems.cs" />
25+
<Compile Include="..\KubernetesClient\Models\IItems.cs" />
2626
<Compile Include="..\KubernetesClient\IKubernetesObject.cs" />
27-
<Compile Include="..\KubernetesClient\IMetadata.cs" />
27+
<Compile Include="..\KubernetesClient\Models\IMetadata.cs" />
2828
<Compile Include="..\KubernetesClient\Models\IntOrStringJsonConverter.cs" />
2929
<Compile Include="..\KubernetesClient\Models\IntOrStringYamlConverter.cs" />
3030
<Compile Include="..\KubernetesClient\Models\IntOrString.cs" />
31-
<Compile Include="..\KubernetesClient\ISpec.cs" />
32-
<Compile Include="..\KubernetesClient\IStatus.cs" />
31+
<Compile Include="..\KubernetesClient\Models\ISpec.cs" />
32+
<Compile Include="..\KubernetesClient\Models\IStatus.cs" />
33+
<Compile Include="..\KubernetesClient\IValidate.cs" />
3334
<Compile Include="..\KubernetesClient\Models\KubernetesEntityAttribute.cs" />
3435
<Compile Include="..\KubernetesClient\KubernetesJson.cs" />
3536
<Compile Include="..\KubernetesClient\Models\KubernetesList.cs" />

src/KubernetesClient/IItems.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/KubernetesClient/IMetadata.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/KubernetesClient/ISpec.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
namespace k8s.Models;
2+
3+
/// <summary>
4+
/// Kubernetes object that exposes list of objects
5+
/// </summary>
6+
/// <typeparam name="T">type of the objects</typeparam>
7+
public interface IItems<T>
8+
{
9+
/// <summary>
10+
/// Gets or sets list of objects. More info:
11+
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md
12+
/// </summary>
13+
IList<T> Items { get; set; }
14+
}
15+
16+
public static class ItemsExt
17+
{
18+
public static IEnumerator<T> GetEnumerator<T>(this IItems<T> items)
19+
{
20+
if (items is null)
21+
{
22+
throw new ArgumentNullException(nameof(items));
23+
}
24+
25+
return items.Items.GetEnumerator();
26+
}
27+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace k8s.Models;
2+
3+
/// <summary>
4+
/// Kubernetes object that exposes metadata
5+
/// </summary>
6+
/// <typeparam name="T">Type of metadata exposed. Usually this will be either
7+
/// <see cref="V1ListMeta"/> for lists or <see cref="V1ObjectMeta"/> for objects</typeparam>
8+
public interface IMetadata<T>
9+
{
10+
/// <summary>
11+
/// Gets or sets standard object's metadata. More info:
12+
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
13+
/// </summary>
14+
T Metadata { get; set; }
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace k8s.Models;
2+
3+
/// <summary>
4+
/// Represents a Kubernetes object that has a spec
5+
/// </summary>
6+
/// <typeparam name="T">type of Kubernetes object</typeparam>
7+
public interface ISpec<T>
8+
{
9+
/// <summary>
10+
/// Gets or sets specification of the desired behavior of the entity. More
11+
/// info:
12+
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
13+
/// </summary>
14+
T Spec { get; set; }
15+
}

src/KubernetesClient/IStatus.cs renamed to src/KubernetesClient/Models/IStatus.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace k8s
1+
namespace k8s.Models
22
{
33
/// <summary>
44
/// Kubernetes object that exposes status

0 commit comments

Comments
 (0)