|
1 | 1 | // |
2 | 2 | // DISCLAIMER |
3 | 3 | // |
4 | | -// Copyright 2023 ArangoDB GmbH, Cologne, Germany |
| 4 | +// Copyright 2023-2024 ArangoDB GmbH, Cologne, Germany |
5 | 5 | // |
6 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | // you may not use this file except in compliance with the License. |
@@ -64,6 +64,39 @@ func WithContextTimeoutP2A2[P1, P2, A1, A2 interface{}](ctx context.Context, tim |
64 | 64 | return f(nCtx, a1, a2) |
65 | 65 | } |
66 | 66 |
|
| 67 | +func WithKubernetesContextTimeoutP1A4[P1, A1, A2, A3, A4 interface{}](ctx context.Context, f func(context.Context, A1, A2, A3, A4) P1, a1 A1, a2 A2, a3 A3, a4 A4) P1 { |
| 68 | + return WithContextTimeoutP1A4(ctx, globals.GetGlobals().Timeouts().Kubernetes().Get(), f, a1, a2, a3, a4) |
| 69 | +} |
| 70 | + |
| 71 | +func WithContextTimeoutP1A4[P1, A1, A2, A3, A4 interface{}](ctx context.Context, timeout time.Duration, f func(context.Context, A1, A2, A3, A4) P1, a1 A1, a2 A2, a3 A3, a4 A4) P1 { |
| 72 | + nCtx, c := context.WithTimeout(ctx, timeout) |
| 73 | + defer c() |
| 74 | + |
| 75 | + return f(nCtx, a1, a2, a3, a4) |
| 76 | +} |
| 77 | + |
| 78 | +func WithKubernetesContextTimeoutP2A4[P1, P2, A1, A2, A3, A4 interface{}](ctx context.Context, f func(context.Context, A1, A2, A3, A4) (P1, P2), a1 A1, a2 A2, a3 A3, a4 A4) (P1, P2) { |
| 79 | + return WithContextTimeoutP2A4(ctx, globals.GetGlobals().Timeouts().Kubernetes().Get(), f, a1, a2, a3, a4) |
| 80 | +} |
| 81 | + |
| 82 | +func WithContextTimeoutP2A4[P1, P2, A1, A2, A3, A4 interface{}](ctx context.Context, timeout time.Duration, f func(context.Context, A1, A2, A3, A4) (P1, P2), a1 A1, a2 A2, a3 A3, a4 A4) (P1, P2) { |
| 83 | + nCtx, c := context.WithTimeout(ctx, timeout) |
| 84 | + defer c() |
| 85 | + |
| 86 | + return f(nCtx, a1, a2, a3, a4) |
| 87 | +} |
| 88 | + |
| 89 | +func WithKubernetesContextTimeoutP4A3[P1, P2, P3, P4, A1, A2, A3 interface{}](ctx context.Context, f func(context.Context, A1, A2, A3) (P1, P2, P3, P4), a1 A1, a2 A2, a3 A3) (P1, P2, P3, P4) { |
| 90 | + return WithContextTimeoutP4A3(ctx, globals.GetGlobals().Timeouts().Kubernetes().Get(), f, a1, a2, a3) |
| 91 | +} |
| 92 | + |
| 93 | +func WithContextTimeoutP4A3[P1, P2, P3, P4, A1, A2, A3 interface{}](ctx context.Context, timeout time.Duration, f func(context.Context, A1, A2, A3) (P1, P2, P3, P4), a1 A1, a2 A2, a3 A3) (P1, P2, P3, P4) { |
| 94 | + nCtx, c := context.WithTimeout(ctx, timeout) |
| 95 | + defer c() |
| 96 | + |
| 97 | + return f(nCtx, a1, a2, a3) |
| 98 | +} |
| 99 | + |
67 | 100 | type PatchInterface[P1 meta.Object] interface { |
68 | 101 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (P1, error) |
69 | 102 | } |
|
0 commit comments