Clean up warnings in examples (#1628)

* Refactor examples to streamline code structure and improve readability

* Update LangVersion to 13.0 for improved compatibility
This commit is contained in:
Boshi Lian
2025-04-29 16:55:55 -07:00
committed by GitHub
parent 001189de77
commit ae79be6665
17 changed files with 335 additions and 446 deletions

View File

@@ -10,22 +10,23 @@ namespace webApiDependencyInjection.Controllers
private readonly IKubernetes kubernetesClient;
/// <summary>
/// Inject the kubernets class in the constructor.
/// Initializes a new instance of the <see cref="ExampleDependencyInjectionOnConstructorController"/> class.
/// Injects the Kubernetes client into the controller.
/// </summary>
/// <param name="kubernetesClient"></param>
/// <param name="kubernetesClient">The Kubernetes client to interact with the Kubernetes API.</param>
public ExampleDependencyInjectionOnConstructorController(IKubernetes kubernetesClient)
{
this.kubernetesClient = kubernetesClient;
}
/// <summary>
/// Example using the kubernetes client obtained from the constructor (this.kubernetesClient).
/// Retrieves the names of all pods in the default namespace using the injected Kubernetes client.
/// </summary>
/// <returns></returns>
[HttpGet()]
/// <returns>A collection of pod names in the default namespace.</returns>
[HttpGet]
public IEnumerable<string> GetPods()
{
// Read the list of pods contained in default namespace
// Read the list of pods contained in the default namespace
var podList = this.kubernetesClient.CoreV1.ListNamespacedPod("default");
// Return names of pods