Files
csharp/src/KubernetesClient/V1Patch.cs

55 lines
1.3 KiB
C#
Raw Normal View History

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
{
/// <summary>
/// not set, this is not allowed
/// </summary>
Unknown,
/// <summary>
/// content type application/json-patch+json
/// </summary>
JsonPatch,
/// <summary>
/// content type application/merge-patch+json
/// </summary>
MergePatch,
/// <summary>
/// content type application/strategic-merge-patch+json
/// </summary>
StrategicMergePatch,
}
2020-11-17 05:40:04 -08:00
public PatchType Type { get; private set; }
public V1Patch(object body, PatchType type)
{
Content = body;
Type = type;
CustomInit();
2020-11-17 05:40:04 -08:00
}
partial void CustomInit()
{
if (Content == null)
{
throw new ArgumentNullException(nameof(Content), "object must be set");
2020-11-17 05:40:04 -08:00
}
if (Type == PatchType.Unknown)
2020-11-17 05:40:04 -08:00
{
throw new ArgumentException("patch type must be set", nameof(Type));
}
}
}
}