2018-01-26 13:57:42 +08:00
|
|
|
using System;
|
|
|
|
|
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
|
|
|
{
|
2020-11-22 14:52:09 -08:00
|
|
|
/// <summary>
|
|
|
|
|
/// not set, this is not allowed
|
|
|
|
|
/// </summary>
|
2020-11-17 10:38:05 -08:00
|
|
|
Unknown,
|
2020-11-22 14:52:09 -08:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// content type application/json-patch+json
|
|
|
|
|
/// </summary>
|
2018-01-26 13:57:42 +08:00
|
|
|
JsonPatch,
|
2020-11-22 14:52:09 -08:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// content type application/merge-patch+json
|
|
|
|
|
/// </summary>
|
2018-01-26 13:57:42 +08:00
|
|
|
MergePatch,
|
2020-11-22 14:52:09 -08:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// content type application/strategic-merge-patch+json
|
|
|
|
|
/// </summary>
|
2018-01-26 13:57:42 +08:00
|
|
|
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-17 10:38:05 -08:00
|
|
|
public V1Patch(object body, PatchType type)
|
2018-01-26 13:57:42 +08:00
|
|
|
{
|
2020-11-17 10:38:05 -08:00
|
|
|
Content = body;
|
|
|
|
|
Type = type;
|
|
|
|
|
CustomInit();
|
2020-11-17 05:40:04 -08:00
|
|
|
}
|
|
|
|
|
|
2018-01-26 13:57:42 +08:00
|
|
|
partial void CustomInit()
|
|
|
|
|
{
|
2020-11-17 10:38:05 -08:00
|
|
|
if (Content == null)
|
2018-01-26 13:57:42 +08:00
|
|
|
{
|
2020-11-17 10:38:05 -08:00
|
|
|
throw new ArgumentNullException(nameof(Content), "object must be set");
|
2020-11-17 05:40:04 -08:00
|
|
|
}
|
|
|
|
|
|
2020-11-17 10:38:05 -08:00
|
|
|
if (Type == PatchType.Unknown)
|
2020-11-17 05:40:04 -08:00
|
|
|
{
|
2020-11-17 10:38:05 -08:00
|
|
|
throw new ArgumentException("patch type must be set", nameof(Type));
|
2018-01-26 13:57:42 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|