Skip to content

Commit 5e9668b

Browse files
author
Christoph Bühler
committed
style: split up the classes in custom kubernets entity
This removes the need for the suppresswarning
1 parent daa46bf commit 5e9668b

File tree

3 files changed

+38
-27
lines changed

3 files changed

+38
-27
lines changed
Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,13 @@
1-
using System.Diagnostics.CodeAnalysis;
2-
using k8s;
1+
using k8s;
32
using k8s.Models;
43

54
namespace KubeOps.Operator.Entities
65
{
7-
[SuppressMessage(
8-
"StyleCop.CSharp.MaintainabilityRules",
9-
"SA1402:FileMayOnlyContainASingleType",
10-
Justification = "This naming of generics should appear in the same file.")]
6+
/// <summary>
7+
/// Defines a custom kubernetes entity which can be used in finalizers and controllers.
8+
/// </summary>
119
public abstract class CustomKubernetesEntity : KubernetesObject, IKubernetesObject<V1ObjectMeta>
1210
{
1311
public V1ObjectMeta Metadata { get; set; } = new V1ObjectMeta();
1412
}
15-
16-
[SuppressMessage(
17-
"StyleCop.CSharp.MaintainabilityRules",
18-
"SA1402:FileMayOnlyContainASingleType",
19-
Justification = "This naming of generics should appear in the same file.")]
20-
public abstract class CustomKubernetesEntity<TSpec> : CustomKubernetesEntity, ISpec<TSpec>
21-
where TSpec : new()
22-
{
23-
public TSpec Spec { get; set; } = new TSpec();
24-
}
25-
26-
[SuppressMessage(
27-
"StyleCop.CSharp.MaintainabilityRules",
28-
"SA1402:FileMayOnlyContainASingleType",
29-
Justification = "This naming of generics should appear in the same file.")]
30-
public abstract class CustomKubernetesEntity<TSpec, TStatus> : CustomKubernetesEntity<TSpec>, IStatus<TStatus>
31-
where TSpec : new()
32-
where TStatus : new()
33-
{
34-
public TStatus Status { get; set; } = new TStatus();
35-
}
3613
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using k8s;
2+
3+
namespace KubeOps.Operator.Entities
4+
{
5+
/// <summary>
6+
/// Defines a custom kubernetes entity which can be used in finalizers and controllers.
7+
/// This entity contains a spec (like <see cref="CustomKubernetesEntity{TSpec}"/>)
8+
/// and a status (<see cref="Status"/>) which can be updated to reflect the state
9+
/// of the entity.
10+
/// </summary>
11+
/// <typeparam name="TSpec">The type of the specified data.</typeparam>
12+
/// <typeparam name="TStatus">The type of the status data.</typeparam>
13+
public abstract class CustomKubernetesEntity<TSpec, TStatus> : CustomKubernetesEntity<TSpec>, IStatus<TStatus>
14+
where TSpec : new()
15+
where TStatus : new()
16+
{
17+
public TStatus Status { get; set; } = new TStatus();
18+
}
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using k8s;
2+
3+
namespace KubeOps.Operator.Entities
4+
{
5+
/// <summary>
6+
/// Defines a custom kubernetes entity which can be used in finalizers and controllers.
7+
/// This entity contains a <see cref="Spec"/>, which means in contains specified data.
8+
/// </summary>
9+
/// <typeparam name="TSpec">The type of the specified data.</typeparam>
10+
public abstract class CustomKubernetesEntity<TSpec> : CustomKubernetesEntity, ISpec<TSpec>
11+
where TSpec : new()
12+
{
13+
public TSpec Spec { get; set; } = new TSpec();
14+
}
15+
}

0 commit comments

Comments
 (0)