Skip to content

Commit 4d752ed

Browse files
committed
fix: update client example to use correct Pod list method and improve Obsolete attribute formatting
1 parent 9ac1f9c commit 4d752ed

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

examples/clientset/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using k8s;
2+
using k8s.Models;
23
using k8s.ClientSets;
34
using System.Threading.Tasks;
45

@@ -13,7 +14,7 @@ private static async Task Main(string[] args)
1314

1415
var clientSet = new ClientSet(client);
1516
var list = await clientSet.CoreV1.Pod.ListAsync("default").ConfigureAwait(false);
16-
foreach (var item in list.Items)
17+
foreach (var item in list)
1718
{
1819
System.Console.WriteLine(item.Metadata.Name);
1920
}

src/LibKubernetesGenerator/templates/IOperations.cs.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public partial interface I{{name}}Operations
2727
/// </param>
2828
{{if IfParamContains api.operation "watch"}}
2929
[Obsolete("This method will be deprecated in future versions. Please use the Watch method instead.")]
30-
{{ end }}
30+
{{end}}
3131
Task<HttpOperationResponse{{GetReturnType api.operation "<>"}}> {{GetOperationId api.operation "WithHttpMessagesAsync"}}(
3232
{{ for parameter in api.operation.parameters}}
3333
{{GetDotNetTypeOpenApiParameter parameter}} {{GetDotNetNameOpenApiParameter parameter "true"}},

tests/KubernetesClient.Tests/WatchTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ await Assert.ThrowsAsync<TaskCanceledException>(async () =>
568568
Host = server.Uri.ToString(),
569569
HttpClientTimeout = TimeSpan.FromSeconds(5),
570570
});
571-
await client.CoreV1.ListNamespacedPodWithHttpMessagesAsync("default").ConfigureAwait(true);
571+
await client.CoreV1.ListNamespacedPodAsync("default").ConfigureAwait(true);
572572
}).ConfigureAwait(true);
573573

574574
// cts
@@ -580,7 +580,7 @@ await Assert.ThrowsAsync<TaskCanceledException>(async () =>
580580
{
581581
Host = server.Uri.ToString(),
582582
});
583-
await client.CoreV1.ListNamespacedPodWithHttpMessagesAsync("default", cancellationToken: cts.Token).ConfigureAwait(true);
583+
await client.CoreV1.ListNamespacedPodAsync("default", cancellationToken: cts.Token).ConfigureAwait(true);
584584
}).ConfigureAwait(true);
585585
}
586586

0 commit comments

Comments
 (0)