Files
csharp/src/KubernetesClient/V1Patch.cs

47 lines
952 B
C#
Raw Normal View History

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
{
JsonPatch,
MergePatch,
StrategicMergePatch,
}
2020-11-17 05:40:04 -08:00
public PatchType Type { get; private set; }
public V1Patch(IJsonPatchDocument jsonPatch)
: this((object)jsonPatch)
{
}
2020-11-17 05:40:04 -08:00
public V1Patch(String body, PatchType type)
: this(body)
{
this.Type = type;
}
partial void CustomInit()
{
if (Content is IJsonPatchDocument)
{
2020-11-17 05:40:04 -08:00
Type = PatchType.JsonPatch;
return;
}
if (Content is String)
{
return;
}
throw new NotSupportedException();
}
}
}