mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
common: remove MarshalJSON helpers for mapstructure
They are not needed anymore since we don't exchange configuration files
using JSON, since baac495b9c.
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
package helpers
|
package helpers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
@@ -234,12 +233,3 @@ func ParametrizedConfigurationMarshalYAML[OuterConfiguration any, InnerConfigura
|
|||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParametrizedConfigurationMarshalJSON undoes ParametrizedConfigurationUnmarshallerHook().
|
|
||||||
func ParametrizedConfigurationMarshalJSON[OuterConfiguration any, InnerConfiguration any](oc OuterConfiguration, innerConfigurationMap map[string](func() InnerConfiguration)) ([]byte, error) {
|
|
||||||
result, err := ParametrizedConfigurationMarshalYAML(oc, innerConfigurationMap)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return json.Marshal(result)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -108,11 +108,6 @@ func (cc CacheConfiguration) MarshalYAML() (interface{}, error) {
|
|||||||
return helpers.ParametrizedConfigurationMarshalYAML(cc, cacheConfigurationMap)
|
return helpers.ParametrizedConfigurationMarshalYAML(cc, cacheConfigurationMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON undoes ConfigurationUnmarshallerHook().
|
|
||||||
func (cc CacheConfiguration) MarshalJSON() ([]byte, error) {
|
|
||||||
return helpers.ParametrizedConfigurationMarshalJSON(cc, cacheConfigurationMap)
|
|
||||||
}
|
|
||||||
|
|
||||||
var cacheConfigurationMap = map[string](func() CacheBackendConfiguration){
|
var cacheConfigurationMap = map[string](func() CacheBackendConfiguration){
|
||||||
"memory": DefaultMemoryCacheConfiguration,
|
"memory": DefaultMemoryCacheConfiguration,
|
||||||
"redis": DefaultRedisCacheConfiguration,
|
"redis": DefaultRedisCacheConfiguration,
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ func (input graphLineHandlerInput) toSQL1(axis int, options toSQL1Options) strin
|
|||||||
dimensionsInterpolate = "emptyArrayString()"
|
dimensionsInterpolate = "emptyArrayString()"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// With
|
// With
|
||||||
withStr := ""
|
withStr := ""
|
||||||
if !options.skipWithClause {
|
if !options.skipWithClause {
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ func (c *Component) fixQueryColumnName(name string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func metricForTopSort(inputUnit string) string {
|
func metricForTopSort(inputUnit string) string {
|
||||||
switch inputUnit {
|
switch inputUnit {
|
||||||
case "pps":
|
case "pps":
|
||||||
@@ -41,4 +40,4 @@ func metricForTopSort(inputUnit string) string {
|
|||||||
default:
|
default:
|
||||||
return "Bytes"
|
return "Bytes"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,11 +55,6 @@ func (ic InputConfiguration) MarshalYAML() (interface{}, error) {
|
|||||||
return helpers.ParametrizedConfigurationMarshalYAML(ic, inputs)
|
return helpers.ParametrizedConfigurationMarshalYAML(ic, inputs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON undoes ConfigurationUnmarshallerHook().
|
|
||||||
func (ic InputConfiguration) MarshalJSON() ([]byte, error) {
|
|
||||||
return helpers.ParametrizedConfigurationMarshalJSON(ic, inputs)
|
|
||||||
}
|
|
||||||
|
|
||||||
var inputs = map[string](func() input.Configuration){
|
var inputs = map[string](func() input.Configuration){
|
||||||
"udp": udp.DefaultConfiguration,
|
"udp": udp.DefaultConfiguration,
|
||||||
"file": file.DefaultConfiguration,
|
"file": file.DefaultConfiguration,
|
||||||
|
|||||||
@@ -94,11 +94,6 @@ func (pc ProviderConfiguration) MarshalYAML() (interface{}, error) {
|
|||||||
return helpers.ParametrizedConfigurationMarshalYAML(pc, providers)
|
return helpers.ParametrizedConfigurationMarshalYAML(pc, providers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON undoes ConfigurationUnmarshallerHook().
|
|
||||||
func (pc ProviderConfiguration) MarshalJSON() ([]byte, error) {
|
|
||||||
return helpers.ParametrizedConfigurationMarshalJSON(pc, providers)
|
|
||||||
}
|
|
||||||
|
|
||||||
var providers = map[string](func() provider.Configuration){
|
var providers = map[string](func() provider.Configuration){
|
||||||
"snmp": snmp.DefaultConfiguration,
|
"snmp": snmp.DefaultConfiguration,
|
||||||
"gnmi": gnmi.DefaultConfiguration,
|
"gnmi": gnmi.DefaultConfiguration,
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ outer2:
|
|||||||
iface := state.Interfaces[index]
|
iface := state.Interfaces[index]
|
||||||
// Set name
|
// Set name
|
||||||
if iface.Name == "" && len(model.IfNameKeys) > 0 {
|
if iface.Name == "" && len(model.IfNameKeys) > 0 {
|
||||||
inner3:
|
inner3:
|
||||||
for _, key := range strings.Split(keys, ",") {
|
for _, key := range strings.Split(keys, ",") {
|
||||||
for _, name := range model.IfNameKeys {
|
for _, name := range model.IfNameKeys {
|
||||||
pfx := fmt.Sprintf("%s=", name)
|
pfx := fmt.Sprintf("%s=", name)
|
||||||
|
|||||||
@@ -32,11 +32,6 @@ func (pc ProviderConfiguration) MarshalYAML() (interface{}, error) {
|
|||||||
return helpers.ParametrizedConfigurationMarshalYAML(pc, providers)
|
return helpers.ParametrizedConfigurationMarshalYAML(pc, providers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON undoes ConfigurationUnmarshallerHook().
|
|
||||||
func (pc ProviderConfiguration) MarshalJSON() ([]byte, error) {
|
|
||||||
return helpers.ParametrizedConfigurationMarshalJSON(pc, providers)
|
|
||||||
}
|
|
||||||
|
|
||||||
var providers = map[string](func() provider.Configuration){
|
var providers = map[string](func() provider.Configuration){
|
||||||
"bmp": bmp.DefaultConfiguration,
|
"bmp": bmp.DefaultConfiguration,
|
||||||
"bioris": bioris.DefaultConfiguration,
|
"bioris": bioris.DefaultConfiguration,
|
||||||
|
|||||||
Reference in New Issue
Block a user