|
1 |
| -using k8s; |
2 |
| -using k8s.Models; |
3 |
| - |
4 |
| -namespace KubeOps.Abstractions.Finalizer; |
5 |
| - |
6 |
| -/// <summary> |
7 |
| -/// <para> |
8 |
| -/// Injectable delegate for finalizers. This delegate is used to attach a finalizer |
9 |
| -/// with its identifier to an entity. When injected, simply call the delegate with |
10 |
| -/// the entity to attach the finalizer. |
11 |
| -/// </para> |
12 |
| -/// <para> |
13 |
| -/// As with other (possibly) mutating calls, use the returned entity for further |
14 |
| -/// modification and Kubernetes client interactions, since the resource version |
15 |
| -/// is updated each time the entity is modified. |
16 |
| -/// </para> |
17 |
| -/// </summary> |
18 |
| -/// <typeparam name="TImplementation">The type of the entity finalizer.</typeparam> |
19 |
| -/// <typeparam name="TEntity">The type of the Kubernetes entity.</typeparam> |
20 |
| -/// <param name="entity">The instance of the entity, that the finalizer is attached if needed.</param> |
21 |
| -/// <returns>A <see cref="Task"/> that resolves when the finalizer was attached.</returns> |
22 |
| -/// <example> |
23 |
| -/// <code> |
24 |
| -/// [EntityRbac(typeof(V1TestEntity), Verbs = RbacVerb.All)] |
25 |
| -/// public class V1TestEntityController : IEntityController<V1TestEntity> |
26 |
| -/// { |
27 |
| -/// private readonly EntityFinalizerAttacher<FinalizerOne, V1TestEntity> _finalizer1; |
28 |
| -/// |
29 |
| -/// public V1TestEntityController( |
30 |
| -/// EntityFinalizerAttacher<FinalizerOne, V1TestEntity> finalizer1) => _finalizer1 = finalizer1; |
31 |
| -/// |
32 |
| -/// public async Task ReconcileAsync(V1TestEntity entity) |
33 |
| -/// { |
34 |
| -/// entity = await _finalizer1(entity); |
35 |
| -/// } |
36 |
| -/// } |
37 |
| -/// </code> |
38 |
| -/// </example> |
39 |
| -public delegate Task<TEntity> EntityFinalizerAttacher<TImplementation, TEntity>(TEntity entity) |
40 |
| - where TImplementation : IEntityFinalizer<TEntity> |
41 |
| - where TEntity : IKubernetesObject<V1ObjectMeta>; |
| 1 | +using k8s; |
| 2 | +using k8s.Models; |
| 3 | + |
| 4 | +namespace KubeOps.Abstractions.Finalizer; |
| 5 | + |
| 6 | +/// <summary> |
| 7 | +/// <para> |
| 8 | +/// Injectable delegate for finalizers. This delegate is used to attach a finalizer |
| 9 | +/// with its identifier to an entity. When injected, simply call the delegate with |
| 10 | +/// the entity to attach the finalizer. |
| 11 | +/// </para> |
| 12 | +/// <para> |
| 13 | +/// As with other (possibly) mutating calls, use the returned entity for further |
| 14 | +/// modification and Kubernetes client interactions, since the resource version |
| 15 | +/// is updated each time the entity is modified. |
| 16 | +/// </para> |
| 17 | +/// </summary> |
| 18 | +/// <typeparam name="TImplementation">The type of the entity finalizer.</typeparam> |
| 19 | +/// <typeparam name="TEntity">The type of the Kubernetes entity.</typeparam> |
| 20 | +/// <param name="entity">The instance of the entity, that the finalizer is attached if needed.</param> |
| 21 | +/// <returns>A <see cref="Task"/> that resolves when the finalizer was attached.</returns> |
| 22 | +/// <example> |
| 23 | +/// <code> |
| 24 | +/// [EntityRbac(typeof(V1TestEntity), Verbs = RbacVerb.All)] |
| 25 | +/// public class V1TestEntityController : IEntityController<V1TestEntity> |
| 26 | +/// { |
| 27 | +/// private readonly EntityFinalizerAttacher<FinalizerOne, V1TestEntity> _finalizer1; |
| 28 | +/// |
| 29 | +/// public V1TestEntityController( |
| 30 | +/// EntityFinalizerAttacher<FinalizerOne, V1TestEntity> finalizer1) => _finalizer1 = finalizer1; |
| 31 | +/// |
| 32 | +/// public async Task ReconcileAsync(V1TestEntity entity) |
| 33 | +/// { |
| 34 | +/// entity = await _finalizer1(entity); |
| 35 | +/// } |
| 36 | +/// } |
| 37 | +/// </code> |
| 38 | +/// </example> |
| 39 | +public delegate Task<TEntity> EntityFinalizerAttacher<TImplementation, TEntity>(TEntity entity) |
| 40 | + where TImplementation : IEntityFinalizer<TEntity> |
| 41 | + where TEntity : IKubernetesObject<V1ObjectMeta>; |
0 commit comments