policy-engine/pkg/chain/chain_easyjson.go
Dmitrii Stepanov 88c2a476b0 [#1] chain: Add json marshal/unmarshal
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-01-24 11:04:03 +03:00

458 lines
9.8 KiB
Go

// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package chain
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
_ *jlexer.Lexer
_ *jwriter.Writer
_ easyjson.Marshaler
)
func easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain(in *jlexer.Lexer, out *Chain) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "ID":
(out.ID).UnmarshalEasyJSON(in)
case "Rules":
if in.IsNull() {
in.Skip()
out.Rules = nil
} else {
in.Delim('[')
if out.Rules == nil {
if !in.IsDelim(']') {
out.Rules = make([]Rule, 0, 0)
} else {
out.Rules = []Rule{}
}
} else {
out.Rules = (out.Rules)[:0]
}
for !in.IsDelim(']') {
var v1 Rule
easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain1(in, &v1)
out.Rules = append(out.Rules, v1)
in.WantComma()
}
in.Delim(']')
}
case "MatchType":
(out.MatchType).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain(out *jwriter.Writer, in Chain) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"ID\":"
out.RawString(prefix[1:])
(in.ID).MarshalEasyJSON(out)
}
{
const prefix string = ",\"Rules\":"
out.RawString(prefix)
if in.Rules == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v2, v3 := range in.Rules {
if v2 > 0 {
out.RawByte(',')
}
easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain1(out, v3)
}
out.RawByte(']')
}
}
{
const prefix string = ",\"MatchType\":"
out.RawString(prefix)
(in.MatchType).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Chain) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Chain) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Chain) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Chain) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain(l, v)
}
func easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain1(in *jlexer.Lexer, out *Rule) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "Status":
(out.Status).UnmarshalEasyJSON(in)
case "Actions":
easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain2(in, &out.Actions)
case "Resources":
easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain3(in, &out.Resources)
case "Any":
out.Any = bool(in.Bool())
case "Condition":
if in.IsNull() {
in.Skip()
out.Condition = nil
} else {
in.Delim('[')
if out.Condition == nil {
if !in.IsDelim(']') {
out.Condition = make([]Condition, 0, 1)
} else {
out.Condition = []Condition{}
}
} else {
out.Condition = (out.Condition)[:0]
}
for !in.IsDelim(']') {
var v4 Condition
easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain4(in, &v4)
out.Condition = append(out.Condition, v4)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain1(out *jwriter.Writer, in Rule) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"Status\":"
out.RawString(prefix[1:])
(in.Status).MarshalEasyJSON(out)
}
{
const prefix string = ",\"Actions\":"
out.RawString(prefix)
easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain2(out, in.Actions)
}
{
const prefix string = ",\"Resources\":"
out.RawString(prefix)
easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain3(out, in.Resources)
}
{
const prefix string = ",\"Any\":"
out.RawString(prefix)
out.Bool(bool(in.Any))
}
{
const prefix string = ",\"Condition\":"
out.RawString(prefix)
if in.Condition == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v5, v6 := range in.Condition {
if v5 > 0 {
out.RawByte(',')
}
easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain4(out, v6)
}
out.RawByte(']')
}
}
out.RawByte('}')
}
func easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain4(in *jlexer.Lexer, out *Condition) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "Op":
(out.Op).UnmarshalEasyJSON(in)
case "Object":
(out.Object).UnmarshalEasyJSON(in)
case "Key":
out.Key = string(in.String())
case "Value":
out.Value = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain4(out *jwriter.Writer, in Condition) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"Op\":"
out.RawString(prefix[1:])
(in.Op).MarshalEasyJSON(out)
}
{
const prefix string = ",\"Object\":"
out.RawString(prefix)
(in.Object).MarshalEasyJSON(out)
}
{
const prefix string = ",\"Key\":"
out.RawString(prefix)
out.String(string(in.Key))
}
{
const prefix string = ",\"Value\":"
out.RawString(prefix)
out.String(string(in.Value))
}
out.RawByte('}')
}
func easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain3(in *jlexer.Lexer, out *Resources) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "Inverted":
out.Inverted = bool(in.Bool())
case "Names":
if in.IsNull() {
in.Skip()
out.Names = nil
} else {
in.Delim('[')
if out.Names == nil {
if !in.IsDelim(']') {
out.Names = make([]string, 0, 4)
} else {
out.Names = []string{}
}
} else {
out.Names = (out.Names)[:0]
}
for !in.IsDelim(']') {
var v7 string
v7 = string(in.String())
out.Names = append(out.Names, v7)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain3(out *jwriter.Writer, in Resources) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"Inverted\":"
out.RawString(prefix[1:])
out.Bool(bool(in.Inverted))
}
{
const prefix string = ",\"Names\":"
out.RawString(prefix)
if in.Names == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v8, v9 := range in.Names {
if v8 > 0 {
out.RawByte(',')
}
out.String(string(v9))
}
out.RawByte(']')
}
}
out.RawByte('}')
}
func easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain2(in *jlexer.Lexer, out *Actions) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "Inverted":
out.Inverted = bool(in.Bool())
case "Names":
if in.IsNull() {
in.Skip()
out.Names = nil
} else {
in.Delim('[')
if out.Names == nil {
if !in.IsDelim(']') {
out.Names = make([]string, 0, 4)
} else {
out.Names = []string{}
}
} else {
out.Names = (out.Names)[:0]
}
for !in.IsDelim(']') {
var v10 string
v10 = string(in.String())
out.Names = append(out.Names, v10)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain2(out *jwriter.Writer, in Actions) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"Inverted\":"
out.RawString(prefix[1:])
out.Bool(bool(in.Inverted))
}
{
const prefix string = ",\"Names\":"
out.RawString(prefix)
if in.Names == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v11, v12 := range in.Names {
if v11 > 0 {
out.RawByte(',')
}
out.String(string(v12))
}
out.RawByte(']')
}
}
out.RawByte('}')
}