func (c *config) SetGlobalASNumber(asNumber numorstring.ASNumber) error {
	_, err := c.c.Backend.Apply(context.Background(), &model.KVPair{
		Key:   model.GlobalBGPConfigKey{Name: "AsNumber"},
		Value: asNumber.String(),
	})
	return err
}
SetGlobalASNumber sets the global AS Number used by the BGP agent running
on each node.  This may be overridden by an explicitly configured value in
the node resource.
package client
import (
	"context"
	"encoding/json"
	"fmt"
	"strconv"
	log "github.com/sirupsen/logrus"
	"github.com/projectcalico/api/pkg/lib/numorstring"
	"github.com/projectcalico/libcalico-go/lib/backend/model"
	"github.com/projectcalico/libcalico-go/lib/errors"
	"github.com/projectcalico/libcalico-go/lib/net"
)
type ConfigLocation int8
const (
	ConfigLocationNone ConfigLocation = iota
	ConfigLocationNode
	ConfigLocationGlobal
)
var logToBgp = map[string]string{
	"none":     "none",
	"debug":    "debug",
	"info":     "info",
	"warning":  "none",
	"error":    "none",
	"critical": "none",
}
const (
	GlobalDefaultASNumber       = 64512
	GlobalDefaultLogLevel       = "info"
	GlobalDefaultIPIP           = false
	GlobalDefaultNodeToNodeMesh = true
)
type ConfigInterface interface {
	SetNodeToNodeMesh(bool) error
	GetNodeToNodeMesh() (bool, error)
	SetGlobalASNumber(numorstring.ASNumber) error
	GetGlobalASNumber() (numorstring.ASNumber, error)
	SetGlobalIPIP(bool) error
	GetGlobalIPIP() (bool, error)
	SetNodeIPIPTunnelAddress(string, *net.IP) error
	GetNodeIPIPTunnelAddress(string) (*net.IP, error)
	SetGlobalLogLevel(string) error
	GetGlobalLogLevel() (string, error)
	SetNodeLogLevel(string, string) error
	SetNodeLogLevelUseGlobal(string) error
	GetNodeLogLevel(string) (string, ConfigLocation, error)
	GetFelixConfig(string, string) (string, bool, error)
	SetFelixConfig(string, string, string) error
	UnsetFelixConfig(string, string) error
	GetBGPConfig(string, string) (string, bool, error)
	SetBGPConfig(string, string, string) error
	UnsetBGPConfig(string, string) error
}
type config struct {
	c *Client
}
func newConfigs(c *Client) ConfigInterface {
	return &config{c}
}
func (c *config) SetNodeToNodeMesh(enabled bool) error {
	b, _ := json.Marshal(enabled)
	_, err := c.c.Backend.Apply(context.Background(), &model.KVPair{
		Key:   model.GlobalBGPConfigKey{Name: "NodeMeshEnabled"},
		Value: string(b),
	})
	return err
}
func (c *config) GetNodeToNodeMesh() (bool, error) {
	var n bool
	if s, err := c.getValue(model.GlobalBGPConfigKey{Name: "NodeMeshEnabled"}); err != nil {
		log.Info("Error getting node mesh")
		return false, err
	} else if s == nil {
		log.Info("Return default node to node mesh")
		return GlobalDefaultNodeToNodeMesh, nil
	} else if err = json.Unmarshal([]byte(*s), &n); err != nil {
		log.WithField("NodeMeshEnabled", *s).Error("Error parsing node to node mesh")
		return false, err
	} else {
		log.Info("Returning configured node to node mesh")
		return n, nil
	}
}