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>
This commit is contained in:
@@ -67,7 +67,15 @@ var old = JsonSerializer.SerializeToDocument(readCert, serializeOptions);
|
||||
|
||||
var replace = new List<V1CertificateSigningRequestCondition>
|
||||
{
|
||||
new ("True", "Approved", DateTime.UtcNow, DateTime.UtcNow, "This certificate was approved by k8s client", "Approve"),
|
||||
new V1CertificateSigningRequestCondition
|
||||
{
|
||||
Type = "Approved",
|
||||
Status = "True",
|
||||
Reason = "Approve",
|
||||
Message = "This certificate was approved by k8s client",
|
||||
LastUpdateTime = DateTime.UtcNow,
|
||||
LastTransitionTime = DateTime.UtcNow,
|
||||
},
|
||||
};
|
||||
readCert.Status.Conditions = replace;
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ namespace customResource
|
||||
}
|
||||
}
|
||||
|
||||
public class CResourceSpec
|
||||
public record CResourceSpec
|
||||
{
|
||||
[JsonPropertyName("cityName")]
|
||||
public string CityName { get; set; }
|
||||
}
|
||||
|
||||
public class CResourceStatus : V1Status
|
||||
public record CResourceStatus : V1Status
|
||||
{
|
||||
[JsonPropertyName("temperature")]
|
||||
public string Temperature { get; set; }
|
||||
|
||||
@@ -23,7 +23,7 @@ var pod = new V1Pod
|
||||
{
|
||||
Requests = new Dictionary<string, ResourceQuantity>()
|
||||
{
|
||||
["cpu"] = new ResourceQuantity("100m"),
|
||||
["cpu"] = "100m",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user