Files
csharp/src/KubernetesClient/Models/KubernetesList.cs
Boshi Lian 5de1c25cf1 migrate to record (#1665)
* migrate to record

* chore: update project files and clean up unused references

* refactor: convert classes to records and simplify constructors for IntOrString, ResourceQuantity, and V1Patch

* fix: define IsExternalInit to resolve CS0518 error in IntOrString

* refactor: change IntOrString and ResourceQuantity from records to structs, update implicit conversions, and simplify null checks

* refactor: add JsonPropertyName attribute to Value property in IntOrString struct

* refactor: simplify V1Patch constructor and improve argument validation

* refactor: remove unnecessary CultureInfo parameter in ToInt method

* Update src/KubernetesClient/Models/ResourceQuantity.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/KubernetesClient/Models/IntOrString.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Revert "Update src/KubernetesClient/Models/ResourceQuantity.cs"

This reverts commit 62b20a691554659e28d419067220dc1a0620133b.

* refactor: remove commented-out formatting check and simplify build command

* refactor: remove IValidate.cs from project references in Aot and Classic

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-22 14:20:13 -07:00

45 lines
1.6 KiB
C#

namespace k8s.Models
{
public class KubernetesList<T> : IMetadata<V1ListMeta>, IItems<T>
where T : IKubernetesObject
{
public KubernetesList(IList<T> items, string apiVersion = default, string kind = default,
V1ListMeta metadata = default)
{
ApiVersion = apiVersion;
Items = items;
Kind = kind;
Metadata = metadata;
}
/// <summary>
/// Gets or sets aPIVersion defines the versioned schema of this
/// representation of an object. Servers should convert recognized
/// schemas to the latest internal value, and may reject unrecognized
/// values. More info:
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
/// </summary>
[JsonPropertyName("apiVersion")]
public string ApiVersion { get; set; }
[JsonPropertyName("items")]
public IList<T> Items { get; set; }
/// <summary>
/// Gets or sets kind is a string value representing the REST resource
/// this object represents. Servers may infer this from the endpoint
/// the client submits requests to. Cannot be updated. In CamelCase.
/// More info:
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
/// </summary>
[JsonPropertyName("kind")]
public string Kind { get; set; }
/// <summary>
/// Gets or sets standard object's metadata.
/// </summary>
[JsonPropertyName("metadata")]
public V1ListMeta Metadata { get; set; }
}
}