policy-engine/pkg/chain/chain_easyjson.go
Airat Arifullin 84c4872b20 [#75] chain: Refactor ObjectType type
* Rename `ObjectType` to `Kind`;
* Rename `Object` field in `Condition` to `ConditionKind`;
* Regenerate easy-json marshalers/unmarshalers;
* Fix unit-tests

Signed-off-by: Airat Arifullin <aarifullin@yadro.com>
2024-05-13 17:36:17 +03:00

463 lines
9.9 KiB
Go
Generated

// 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":
if in.IsNull() {
in.Skip()
out.ID = nil
} else {
out.ID = in.Bytes()
}
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 v2 Rule
easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain1(in, &v2)
out.Rules = append(out.Rules, v2)
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:])
out.Base64Bytes(in.ID)
}
{
const prefix string = ",\"Rules\":"
out.RawString(prefix)
if in.Rules == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v5, v6 := range in.Rules {
if v5 > 0 {
out.RawByte(',')
}
easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain1(out, v6)
}
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 v7 Condition
easyjsonE2758465DecodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain4(in, &v7)
out.Condition = append(out.Condition, v7)
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 v8, v9 := range in.Condition {
if v8 > 0 {
out.RawByte(',')
}
easyjsonE2758465EncodeGitFrostfsInfoTrueCloudLabPolicyEnginePkgChain4(out, v9)
}
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 "Kind":
(out.Kind).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 = ",\"Kind\":"
out.RawString(prefix)
(in.Kind).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 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 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 v11, v12 := range in.Names {
if v11 > 0 {
out.RawByte(',')
}
out.String(string(v12))
}
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 v13 string
v13 = string(in.String())
out.Names = append(out.Names, v13)
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 v14, v15 := range in.Names {
if v14 > 0 {
out.RawByte(',')
}
out.String(string(v15))
}
out.RawByte(']')
}
}
out.RawByte('}')
}