Tweak logic & add base import/export test
This commit is contained in:
@@ -15,6 +15,7 @@ apigw_filter: {
|
||||
route: {
|
||||
sortable: true, goType: "uint64", storeIdent: "rel_route"
|
||||
dal: { type: "Ref", refModelResType: "corteza::system:apigw-route" }
|
||||
identAlias: ["route", "Route", "ApigwRouteID"]
|
||||
envoy: {
|
||||
store: {
|
||||
omitRefFilter: true
|
||||
@@ -61,6 +62,7 @@ apigw_filter: {
|
||||
envoy: {
|
||||
yaml: {
|
||||
supportMappedInput: false
|
||||
omitEncoder: true
|
||||
}
|
||||
store: {
|
||||
handleField: ""
|
||||
|
||||
@@ -36,6 +36,9 @@ application: {
|
||||
store: {
|
||||
omitRefFilter: true
|
||||
}
|
||||
yaml: {
|
||||
identKeyAlias: ["owner"]
|
||||
}
|
||||
}
|
||||
}
|
||||
created_at: schema.SortableTimestampNowField
|
||||
|
||||
@@ -92,7 +92,6 @@ auth_client: {
|
||||
}
|
||||
|
||||
envoy: {
|
||||
scoped: true
|
||||
yaml: {
|
||||
supportMappedInput: true
|
||||
mappedField: "Handle"
|
||||
|
||||
Generated
+130
-100
@@ -263,12 +263,14 @@ func (d StoreDecoder) decodeApplication(ctx context.Context, s store.Storer, dl
|
||||
r.ID,
|
||||
)
|
||||
|
||||
refs := map[string]envoyx.Ref{
|
||||
// Handle references
|
||||
"OwnerID": envoyx.Ref{
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
if r.OwnerID > 0 {
|
||||
refs["OwnerID"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.OwnerID),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var scope envoyx.Scope
|
||||
@@ -328,27 +330,32 @@ func (d StoreDecoder) decodeApigwRoute(ctx context.Context, s store.Storer, dl d
|
||||
r.ID,
|
||||
)
|
||||
|
||||
refs := map[string]envoyx.Ref{
|
||||
// Handle references
|
||||
"CreatedBy": envoyx.Ref{
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
if r.CreatedBy > 0 {
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.CreatedBy),
|
||||
},
|
||||
// Handle references
|
||||
"DeletedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.DeletedBy > 0 {
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.DeletedBy),
|
||||
},
|
||||
// Handle references
|
||||
"Group": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.Group > 0 {
|
||||
refs["Group"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:apigw-group",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.Group),
|
||||
},
|
||||
// Handle references
|
||||
"UpdatedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.UpdatedBy > 0 {
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.UpdatedBy),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var scope envoyx.Scope
|
||||
@@ -414,27 +421,32 @@ func (d StoreDecoder) decodeApigwFilter(ctx context.Context, s store.Storer, dl
|
||||
r.ID,
|
||||
)
|
||||
|
||||
refs := map[string]envoyx.Ref{
|
||||
// Handle references
|
||||
"CreatedBy": envoyx.Ref{
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
if r.CreatedBy > 0 {
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.CreatedBy),
|
||||
},
|
||||
// Handle references
|
||||
"DeletedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.DeletedBy > 0 {
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.DeletedBy),
|
||||
},
|
||||
// Handle references
|
||||
"Route": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.Route > 0 {
|
||||
refs["Route"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:apigw-route",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.Route),
|
||||
},
|
||||
// Handle references
|
||||
"UpdatedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.UpdatedBy > 0 {
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.UpdatedBy),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var scope envoyx.Scope
|
||||
@@ -491,38 +503,38 @@ func (d StoreDecoder) decodeAuthClient(ctx context.Context, s store.Storer, dl d
|
||||
r.ID,
|
||||
)
|
||||
|
||||
refs := map[string]envoyx.Ref{
|
||||
// Handle references
|
||||
"CreatedBy": envoyx.Ref{
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
if r.CreatedBy > 0 {
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.CreatedBy),
|
||||
},
|
||||
// Handle references
|
||||
"DeletedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.DeletedBy > 0 {
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.DeletedBy),
|
||||
},
|
||||
// Handle references
|
||||
"OwnedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.OwnedBy > 0 {
|
||||
refs["OwnedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.OwnedBy),
|
||||
},
|
||||
// Handle references
|
||||
"UpdatedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.UpdatedBy > 0 {
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.UpdatedBy),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
refs = envoyx.MergeRefs(refs, d.decodeAuthClientRefs(r))
|
||||
|
||||
var scope envoyx.Scope
|
||||
|
||||
scope = envoyx.Scope{
|
||||
ResourceType: types.AuthClientResourceType,
|
||||
Identifiers: ii,
|
||||
}
|
||||
|
||||
out = append(out, &envoyx.Node{
|
||||
Resource: r,
|
||||
|
||||
@@ -579,31 +591,30 @@ func (d StoreDecoder) decodeQueue(ctx context.Context, s store.Storer, dl dal.Fu
|
||||
r.Queue,
|
||||
)
|
||||
|
||||
refs := map[string]envoyx.Ref{
|
||||
// Handle references
|
||||
"CreatedBy": envoyx.Ref{
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
if r.CreatedBy > 0 {
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.CreatedBy),
|
||||
},
|
||||
// Handle references
|
||||
"DeletedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.DeletedBy > 0 {
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.DeletedBy),
|
||||
},
|
||||
// Handle references
|
||||
"UpdatedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.UpdatedBy > 0 {
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.UpdatedBy),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var scope envoyx.Scope
|
||||
|
||||
scope = envoyx.Scope{
|
||||
ResourceType: types.QueueResourceType,
|
||||
Identifiers: ii,
|
||||
}
|
||||
|
||||
out = append(out, &envoyx.Node{
|
||||
Resource: r,
|
||||
|
||||
@@ -656,27 +667,32 @@ func (d StoreDecoder) decodeReport(ctx context.Context, s store.Storer, dl dal.F
|
||||
r.ID,
|
||||
)
|
||||
|
||||
refs := map[string]envoyx.Ref{
|
||||
// Handle references
|
||||
"CreatedBy": envoyx.Ref{
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
if r.CreatedBy > 0 {
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.CreatedBy),
|
||||
},
|
||||
// Handle references
|
||||
"DeletedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.DeletedBy > 0 {
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.DeletedBy),
|
||||
},
|
||||
// Handle references
|
||||
"OwnedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.OwnedBy > 0 {
|
||||
refs["OwnedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.OwnedBy),
|
||||
},
|
||||
// Handle references
|
||||
"UpdatedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.UpdatedBy > 0 {
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.UpdatedBy),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var scope envoyx.Scope
|
||||
@@ -737,6 +753,8 @@ func (d StoreDecoder) decodeRole(ctx context.Context, s store.Storer, dl dal.Ful
|
||||
r.ID,
|
||||
)
|
||||
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
|
||||
var scope envoyx.Scope
|
||||
@@ -797,12 +815,14 @@ func (d StoreDecoder) decodeTemplate(ctx context.Context, s store.Storer, dl dal
|
||||
r.ID,
|
||||
)
|
||||
|
||||
refs := map[string]envoyx.Ref{
|
||||
// Handle references
|
||||
"OwnerID": envoyx.Ref{
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
if r.OwnerID > 0 {
|
||||
refs["OwnerID"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.OwnerID),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var scope envoyx.Scope
|
||||
@@ -863,6 +883,8 @@ func (d StoreDecoder) decodeUser(ctx context.Context, s store.Storer, dl dal.Ful
|
||||
r.ID,
|
||||
)
|
||||
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
|
||||
var scope envoyx.Scope
|
||||
@@ -923,22 +945,26 @@ func (d StoreDecoder) decodeDalConnection(ctx context.Context, s store.Storer, d
|
||||
r.ID,
|
||||
)
|
||||
|
||||
refs := map[string]envoyx.Ref{
|
||||
// Handle references
|
||||
"CreatedBy": envoyx.Ref{
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
if r.CreatedBy > 0 {
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.CreatedBy),
|
||||
},
|
||||
// Handle references
|
||||
"DeletedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.DeletedBy > 0 {
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.DeletedBy),
|
||||
},
|
||||
// Handle references
|
||||
"UpdatedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.UpdatedBy > 0 {
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.UpdatedBy),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
refs = envoyx.MergeRefs(refs, d.decodeDalConnectionRefs(r))
|
||||
@@ -1001,22 +1027,26 @@ func (d StoreDecoder) decodeDalSensitivityLevel(ctx context.Context, s store.Sto
|
||||
r.ID,
|
||||
)
|
||||
|
||||
refs := map[string]envoyx.Ref{
|
||||
// Handle references
|
||||
"CreatedBy": envoyx.Ref{
|
||||
// Handle references
|
||||
// Omit any non-defined values
|
||||
refs := map[string]envoyx.Ref{}
|
||||
if r.CreatedBy > 0 {
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.CreatedBy),
|
||||
},
|
||||
// Handle references
|
||||
"DeletedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.DeletedBy > 0 {
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.DeletedBy),
|
||||
},
|
||||
// Handle references
|
||||
"UpdatedBy": envoyx.Ref{
|
||||
}
|
||||
}
|
||||
if r.UpdatedBy > 0 {
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(r.UpdatedBy),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var scope envoyx.Scope
|
||||
|
||||
Generated
+231
-35
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/cortezaproject/corteza/server/pkg/y7s"
|
||||
"github.com/cortezaproject/corteza/server/system/types"
|
||||
systemTypes "github.com/cortezaproject/corteza/server/system/types"
|
||||
"github.com/spf13/cast"
|
||||
"golang.org/x/text/language"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
@@ -298,7 +299,7 @@ func (d *auxYamlDoc) unmarshalApplicationNode(dctx documentContext, n *yaml.Node
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
rbacNodes envoyx.NodeSet
|
||||
)
|
||||
_ = auxOut
|
||||
@@ -320,12 +321,18 @@ func (d *auxYamlDoc) unmarshalApplicationNode(dctx documentContext, n *yaml.Node
|
||||
|
||||
break
|
||||
|
||||
case "ownerid":
|
||||
case "ownerid", "owner":
|
||||
// Handle references
|
||||
err = y7s.DecodeScalar(n, "ownerID", &auxNodeValue)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["OwnerID"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -407,6 +414,11 @@ func (d *auxYamlDoc) unmarshalApplicationNode(dctx documentContext, n *yaml.Node
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -540,7 +552,7 @@ func (d *auxYamlDoc) unmarshalApigwRouteNode(dctx documentContext, n *yaml.Node,
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
rbacNodes envoyx.NodeSet
|
||||
)
|
||||
_ = auxOut
|
||||
@@ -558,6 +570,12 @@ func (d *auxYamlDoc) unmarshalApigwRouteNode(dctx documentContext, n *yaml.Node,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -571,6 +589,12 @@ func (d *auxYamlDoc) unmarshalApigwRouteNode(dctx documentContext, n *yaml.Node,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -584,6 +608,12 @@ func (d *auxYamlDoc) unmarshalApigwRouteNode(dctx documentContext, n *yaml.Node,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["Group"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:apigw-group",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -607,6 +637,12 @@ func (d *auxYamlDoc) unmarshalApigwRouteNode(dctx documentContext, n *yaml.Node,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -696,6 +732,11 @@ func (d *auxYamlDoc) unmarshalApigwRouteNode(dctx documentContext, n *yaml.Node,
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -794,7 +835,7 @@ func (d *auxYamlDoc) unmarshalApigwFilterNode(dctx documentContext, n *yaml.Node
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
)
|
||||
_ = auxOut
|
||||
_ = refs
|
||||
@@ -811,6 +852,12 @@ func (d *auxYamlDoc) unmarshalApigwFilterNode(dctx documentContext, n *yaml.Node
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -824,6 +871,12 @@ func (d *auxYamlDoc) unmarshalApigwFilterNode(dctx documentContext, n *yaml.Node
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -847,6 +900,12 @@ func (d *auxYamlDoc) unmarshalApigwFilterNode(dctx documentContext, n *yaml.Node
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["Route"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:apigw-route",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -860,6 +919,12 @@ func (d *auxYamlDoc) unmarshalApigwFilterNode(dctx documentContext, n *yaml.Node
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -925,6 +990,11 @@ func (d *auxYamlDoc) unmarshalApigwFilterNode(dctx documentContext, n *yaml.Node
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -1024,7 +1094,7 @@ func (d *auxYamlDoc) unmarshalAuthClientNode(dctx documentContext, n *yaml.Node,
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
rbacNodes envoyx.NodeSet
|
||||
)
|
||||
_ = auxOut
|
||||
@@ -1042,6 +1112,12 @@ func (d *auxYamlDoc) unmarshalAuthClientNode(dctx documentContext, n *yaml.Node,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1055,6 +1131,12 @@ func (d *auxYamlDoc) unmarshalAuthClientNode(dctx documentContext, n *yaml.Node,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1088,6 +1170,12 @@ func (d *auxYamlDoc) unmarshalAuthClientNode(dctx documentContext, n *yaml.Node,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["OwnedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1120,6 +1208,12 @@ func (d *auxYamlDoc) unmarshalAuthClientNode(dctx documentContext, n *yaml.Node,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1153,15 +1247,6 @@ func (d *auxYamlDoc) unmarshalAuthClientNode(dctx documentContext, n *yaml.Node,
|
||||
return
|
||||
}
|
||||
|
||||
// Define the scope
|
||||
//
|
||||
// This resource is scoped with no parent resources so this resource is the
|
||||
// root itself (generally the namespace -- the only currently supported scenario).
|
||||
scope = envoyx.Scope{
|
||||
ResourceType: types.AuthClientResourceType,
|
||||
Identifiers: ii,
|
||||
}
|
||||
|
||||
// Apply the scope to all of the references of the same type
|
||||
for k, ref := range refs {
|
||||
if ref.ResourceType != scope.ResourceType {
|
||||
@@ -1210,6 +1295,11 @@ func (d *auxYamlDoc) unmarshalAuthClientNode(dctx documentContext, n *yaml.Node,
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -1229,8 +1319,6 @@ func (d *auxYamlDoc) unmarshalAuthClientNode(dctx documentContext, n *yaml.Node,
|
||||
Identifiers: ii,
|
||||
References: refs,
|
||||
|
||||
Scope: scope,
|
||||
|
||||
Config: envoyConfig,
|
||||
}
|
||||
// Update RBAC resource nodes with references regarding the resource
|
||||
@@ -1329,7 +1417,7 @@ func (d *auxYamlDoc) unmarshalQueueNode(dctx documentContext, n *yaml.Node, meta
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
rbacNodes envoyx.NodeSet
|
||||
)
|
||||
_ = auxOut
|
||||
@@ -1347,6 +1435,12 @@ func (d *auxYamlDoc) unmarshalQueueNode(dctx documentContext, n *yaml.Node, meta
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1360,6 +1454,12 @@ func (d *auxYamlDoc) unmarshalQueueNode(dctx documentContext, n *yaml.Node, meta
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1393,6 +1493,12 @@ func (d *auxYamlDoc) unmarshalQueueNode(dctx documentContext, n *yaml.Node, meta
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1426,15 +1532,6 @@ func (d *auxYamlDoc) unmarshalQueueNode(dctx documentContext, n *yaml.Node, meta
|
||||
return
|
||||
}
|
||||
|
||||
// Define the scope
|
||||
//
|
||||
// This resource is scoped with no parent resources so this resource is the
|
||||
// root itself (generally the namespace -- the only currently supported scenario).
|
||||
scope = envoyx.Scope{
|
||||
ResourceType: types.QueueResourceType,
|
||||
Identifiers: ii,
|
||||
}
|
||||
|
||||
// Apply the scope to all of the references of the same type
|
||||
for k, ref := range refs {
|
||||
if ref.ResourceType != scope.ResourceType {
|
||||
@@ -1483,6 +1580,11 @@ func (d *auxYamlDoc) unmarshalQueueNode(dctx documentContext, n *yaml.Node, meta
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -1502,8 +1604,6 @@ func (d *auxYamlDoc) unmarshalQueueNode(dctx documentContext, n *yaml.Node, meta
|
||||
Identifiers: ii,
|
||||
References: refs,
|
||||
|
||||
Scope: scope,
|
||||
|
||||
Config: envoyConfig,
|
||||
}
|
||||
// Update RBAC resource nodes with references regarding the resource
|
||||
@@ -1602,7 +1702,7 @@ func (d *auxYamlDoc) unmarshalReportNode(dctx documentContext, n *yaml.Node, met
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
rbacNodes envoyx.NodeSet
|
||||
)
|
||||
_ = auxOut
|
||||
@@ -1620,6 +1720,12 @@ func (d *auxYamlDoc) unmarshalReportNode(dctx documentContext, n *yaml.Node, met
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1633,6 +1739,12 @@ func (d *auxYamlDoc) unmarshalReportNode(dctx documentContext, n *yaml.Node, met
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1666,6 +1778,12 @@ func (d *auxYamlDoc) unmarshalReportNode(dctx documentContext, n *yaml.Node, met
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["OwnedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1679,6 +1797,12 @@ func (d *auxYamlDoc) unmarshalReportNode(dctx documentContext, n *yaml.Node, met
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -1760,6 +1884,11 @@ func (d *auxYamlDoc) unmarshalReportNode(dctx documentContext, n *yaml.Node, met
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -1877,7 +2006,7 @@ func (d *auxYamlDoc) unmarshalRoleNode(dctx documentContext, n *yaml.Node, meta
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
rbacNodes envoyx.NodeSet
|
||||
)
|
||||
_ = auxOut
|
||||
@@ -1983,6 +2112,11 @@ func (d *auxYamlDoc) unmarshalRoleNode(dctx documentContext, n *yaml.Node, meta
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -2100,7 +2234,7 @@ func (d *auxYamlDoc) unmarshalTemplateNode(dctx documentContext, n *yaml.Node, m
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
rbacNodes envoyx.NodeSet
|
||||
)
|
||||
_ = auxOut
|
||||
@@ -2138,6 +2272,12 @@ func (d *auxYamlDoc) unmarshalTemplateNode(dctx documentContext, n *yaml.Node, m
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["OwnerID"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -2219,6 +2359,11 @@ func (d *auxYamlDoc) unmarshalTemplateNode(dctx documentContext, n *yaml.Node, m
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -2336,7 +2481,7 @@ func (d *auxYamlDoc) unmarshalUserNode(dctx documentContext, n *yaml.Node, meta
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
rbacNodes envoyx.NodeSet
|
||||
)
|
||||
_ = auxOut
|
||||
@@ -2461,6 +2606,11 @@ func (d *auxYamlDoc) unmarshalUserNode(dctx documentContext, n *yaml.Node, meta
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -2578,7 +2728,7 @@ func (d *auxYamlDoc) unmarshalDalConnectionNode(dctx documentContext, n *yaml.No
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
rbacNodes envoyx.NodeSet
|
||||
)
|
||||
_ = auxOut
|
||||
@@ -2596,6 +2746,12 @@ func (d *auxYamlDoc) unmarshalDalConnectionNode(dctx documentContext, n *yaml.No
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -2609,6 +2765,12 @@ func (d *auxYamlDoc) unmarshalDalConnectionNode(dctx documentContext, n *yaml.No
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -2642,6 +2804,12 @@ func (d *auxYamlDoc) unmarshalDalConnectionNode(dctx documentContext, n *yaml.No
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -2723,6 +2891,11 @@ func (d *auxYamlDoc) unmarshalDalConnectionNode(dctx documentContext, n *yaml.No
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -2840,7 +3013,7 @@ func (d *auxYamlDoc) unmarshalDalSensitivityLevelNode(dctx documentContext, n *y
|
||||
auxOut envoyx.NodeSet
|
||||
nestedNodes envoyx.NodeSet
|
||||
scope envoyx.Scope
|
||||
envoyConfig envoyx.NodeConfig
|
||||
envoyConfig envoyx.EnvoyConfig
|
||||
)
|
||||
_ = auxOut
|
||||
_ = refs
|
||||
@@ -2857,6 +3030,12 @@ func (d *auxYamlDoc) unmarshalDalSensitivityLevelNode(dctx documentContext, n *y
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["CreatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -2870,6 +3049,12 @@ func (d *auxYamlDoc) unmarshalDalSensitivityLevelNode(dctx documentContext, n *y
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["DeletedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -2903,6 +3088,12 @@ func (d *auxYamlDoc) unmarshalDalSensitivityLevelNode(dctx documentContext, n *y
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Omit if not defined
|
||||
tmp := cast.ToString(auxNodeValue)
|
||||
if tmp == "0" || tmp == "" {
|
||||
break
|
||||
}
|
||||
refs["UpdatedBy"] = envoyx.Ref{
|
||||
ResourceType: "corteza::system:user",
|
||||
Identifiers: envoyx.MakeIdentifiers(auxNodeValue),
|
||||
@@ -2968,6 +3159,11 @@ func (d *auxYamlDoc) unmarshalDalSensitivityLevelNode(dctx documentContext, n *y
|
||||
}
|
||||
|
||||
for f, ref := range refs {
|
||||
// Only inherit root references
|
||||
// @todo improve; this is a hack
|
||||
if strings.Contains(f, ".") {
|
||||
continue
|
||||
}
|
||||
a.References[f] = ref
|
||||
}
|
||||
}
|
||||
@@ -3117,7 +3313,7 @@ func unmarshalLocaleNode(n *yaml.Node) (out envoyx.NodeSet, err error) {
|
||||
// Envoy config unmarshal logic
|
||||
// // // // // // // // // // // // // // // // // // // // // // // // //
|
||||
|
||||
func (d *auxYamlDoc) decodeEnvoyConfig(n *yaml.Node) (out envoyx.NodeConfig) {
|
||||
func (d *auxYamlDoc) decodeEnvoyConfig(n *yaml.Node) (out envoyx.EnvoyConfig) {
|
||||
y7s.EachMap(n, func(k, v *yaml.Node) (err error) {
|
||||
switch strings.ToLower(k.Value) {
|
||||
case "skipif", "skip":
|
||||
|
||||
@@ -70,6 +70,8 @@ func (d *auxYamlDoc) unmarshalAuthClientSecurityNode(r *types.AuthClient, n *yam
|
||||
}
|
||||
|
||||
func roleSliceToRefs(k string, n *yaml.Node) (refs map[string]envoyx.Ref) {
|
||||
refs = make(map[string]envoyx.Ref, len(n.Content))
|
||||
|
||||
i := 0
|
||||
y7s.EachSeq(n, func(n *yaml.Node) error {
|
||||
refs[fmt.Sprintf("%s.%d", k, i)] = envoyx.Ref{
|
||||
|
||||
Generated
+8
-14
@@ -71,16 +71,7 @@ func (e YamlEncoder) Encode(ctx context.Context, p envoyx.EncodeParams, rt strin
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
case types.ApigwFilterResourceType:
|
||||
aux, err = e.encodeApigwFilters(ctx, p, nodes, tt)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// Root level resources are always encoded as a map
|
||||
out, err = y7s.AddMap(out, "apigwFilter", aux)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
case types.AuthClientResourceType:
|
||||
aux, err = e.encodeAuthClients(ctx, p, nodes, tt)
|
||||
if err != nil {
|
||||
@@ -165,6 +156,10 @@ func (e YamlEncoder) Encode(ctx context.Context, p envoyx.EncodeParams, rt strin
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
default:
|
||||
// When this encoder doesn't handle any node it shouldn't write anything;
|
||||
// this just removes the need for an extra check at the end.
|
||||
return
|
||||
}
|
||||
|
||||
return yaml.NewEncoder(w).Encode(out)
|
||||
@@ -869,7 +864,6 @@ func (e YamlEncoder) encodeUser(ctx context.Context, p envoyx.EncodeParams, node
|
||||
"kind", res.Kind,
|
||||
"meta", res.Meta,
|
||||
"name", res.Name,
|
||||
"roles", res.Roles,
|
||||
"suspendedAt", auxSuspendedAt,
|
||||
"updatedAt", auxUpdatedAt,
|
||||
"username", res.Username,
|
||||
@@ -1046,7 +1040,7 @@ func (e YamlEncoder) encodeTimestamp(p envoyx.EncodeParams, t time.Time) (any, e
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
tz := p.Config.PreferredTimezone
|
||||
tz := p.Encoder.PreferredTimezone
|
||||
if tz != "" {
|
||||
tzL, err := time.LoadLocation(tz)
|
||||
if err != nil {
|
||||
@@ -1055,7 +1049,7 @@ func (e YamlEncoder) encodeTimestamp(p envoyx.EncodeParams, t time.Time) (any, e
|
||||
t = t.In(tzL)
|
||||
}
|
||||
|
||||
ly := p.Config.PreferredTimeLayout
|
||||
ly := p.Encoder.PreferredTimeLayout
|
||||
if ly == "" {
|
||||
ly = time.RFC3339
|
||||
}
|
||||
@@ -1081,7 +1075,7 @@ func (e YamlEncoder) encodeRef(p envoyx.EncodeParams, id uint64, field string, n
|
||||
return id, nil
|
||||
}
|
||||
|
||||
return node.Identifiers.FriendlyIdentifier(), nil
|
||||
return parent.Identifiers.FriendlyIdentifier(), nil
|
||||
}
|
||||
|
||||
// // // // // // // // // // // // // // // // // // // // // // // // //
|
||||
|
||||
@@ -59,7 +59,6 @@ queue: {
|
||||
}
|
||||
|
||||
envoy: {
|
||||
scoped: true
|
||||
yaml: {
|
||||
supportMappedInput: true
|
||||
mappedField: "Queue"
|
||||
|
||||
+2
-2
@@ -190,7 +190,7 @@ func (r *ApigwFilter) GetValue(name string, pos uint) (any, error) {
|
||||
return r.Kind, nil
|
||||
case "ref", "Ref":
|
||||
return r.Ref, nil
|
||||
case "route", "Route":
|
||||
case "route", "Route", "ApigwRouteID":
|
||||
return r.Route, nil
|
||||
case "updatedAt", "UpdatedAt":
|
||||
return r.UpdatedAt, nil
|
||||
@@ -221,7 +221,7 @@ func (r *ApigwFilter) SetValue(name string, pos uint, value any) (err error) {
|
||||
return cast2.String(value, &r.Kind)
|
||||
case "ref", "Ref":
|
||||
return cast2.String(value, &r.Ref)
|
||||
case "route", "Route":
|
||||
case "route", "Route", "ApigwRouteID":
|
||||
return cast2.Uint64(value, &r.Route)
|
||||
case "updatedAt", "UpdatedAt":
|
||||
return cast2.TimePtr(value, &r.UpdatedAt)
|
||||
|
||||
@@ -32,6 +32,7 @@ user: {
|
||||
envoy: {
|
||||
yaml: {
|
||||
customDecoder: true
|
||||
omitEncoder: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user