2018-01-26 13:57:42 +08:00
|
|
|
using System;
|
|
|
|
|
using Microsoft.AspNetCore.JsonPatch;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
namespace k8s.Models
|
|
|
|
|
{
|
|
|
|
|
[JsonConverter(typeof(V1PathJsonConverter))]
|
|
|
|
|
public partial class V1Patch
|
|
|
|
|
{
|
2020-11-17 05:40:04 -08:00
|
|
|
public enum PatchType
|
2018-01-26 13:57:42 +08:00
|
|
|
{
|
|
|
|
|
JsonPatch,
|
|
|
|
|
MergePatch,
|
|
|
|
|
StrategicMergePatch,
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-17 05:40:04 -08:00
|
|
|
public PatchType Type { get; private set; }
|
2018-01-26 13:57:42 +08:00
|
|
|
|
2020-11-01 12:24:51 -08:00
|
|
|
public V1Patch(IJsonPatchDocument jsonPatch)
|
|
|
|
|
: this((object)jsonPatch)
|
2018-01-26 13:57:42 +08:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-17 05:40:04 -08:00
|
|
|
public V1Patch(String body, PatchType type)
|
|
|
|
|
: this(body)
|
|
|
|
|
{
|
|
|
|
|
this.Type = type;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-26 13:57:42 +08:00
|
|
|
partial void CustomInit()
|
|
|
|
|
{
|
|
|
|
|
if (Content is IJsonPatchDocument)
|
|
|
|
|
{
|
2020-11-17 05:40:04 -08:00
|
|
|
Type = PatchType.JsonPatch;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Content is String)
|
|
|
|
|
{
|
2018-01-26 13:57:42 +08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw new NotSupportedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|