func (api *API) UpdateConfig(c *common.Context) (interface{}, error) {
	config, err := api.parseAndCheckConfigView(c)
	if err != nil {
		return nil, err
	}
	ns, n := c.GetNamespace(), c.GetNameFromParam()
	res, err := api.Config.Get(ns, n, "")
	if err != nil {
		return nil, err
	}
	if checkIsSysResources(res.Labels) && !reflect.DeepEqual(res.Labels, config.Labels) {
		return nil, common.Error(common.ErrRequestParamInvalid, common.Field("error", "labels can't be modified of sys apps"))
	}
	if models.EqualConfig(res, config) {
		return api.ToConfigurationView(res)
	}
	config.Version = res.Version
	config.UpdateTimestamp = time.Now()
	config.CreationTimestamp = res.CreationTimestamp
	res, err = api.Facade.UpdateConfig(ns, config)
	if err != nil {
		return nil, err
	}
	return api.ToConfigurationView(res)
}
UpdateConfig update the config
package api
import (
	"encoding/json"
	"reflect"
	"strings"
	"time"
	"github.com/baetyl/baetyl-go/v2/errors"
	"github.com/baetyl/baetyl-go/v2/log"
	specV1 "github.com/baetyl/baetyl-go/v2/spec/v1"
	"github.com/baetyl/baetyl-go/v2/utils"
	"github.com/jinzhu/copier"
	"github.com/baetyl/baetyl-cloud/v2/common"
	"github.com/baetyl/baetyl-cloud/v2/models"
)
const (
	ConfigTypeKV            = "kv"
	ConfigTypeObject        = "object"
	ConfigTypeFunction      = "function"
	ConfigObjectTypeHttp    = "http"
	ConfigImageTypeSelector = "baetyl-config-type=baetyl-image"
)
func (api *API) GetConfig(c *common.Context) (interface{}, error) {
	ns, n := c.GetNamespace(), c.GetNameFromParam()
	config, err := api.Config.Get(ns, n, "")
	if err != nil {
		return nil, err
	}
	return api.ToConfigurationView(config)
}
func (api *API) ListConfig(c *common.Context) (interface{}, error) {
	ns := c.GetNamespace()
	params, err := api.ParseListOptionsAppendSystemLabel(c)
	if err != nil {
		return nil, err
	}
	list, err := api.Config.List(ns, params)
	if err != nil {
		log.L().Error("list config error", log.Error(err))
		return nil, common.Error(common.ErrRequestParamInvalid, common.Field("error", err.Error()))
	}
	for _, cfg := range list.Items {
		if ok, matchErr := utils.IsLabelMatch(ConfigImageTypeSelector, cfg.Labels); matchErr == nil && !ok {
			cfg.Data = nil
		}
	}
	return list, err
}
func (api *API) CreateConfig(c *common.Context) (interface{}, error) {
	config, err := api.parseAndCheckConfigView(c)
	if err != nil {
		log.L().Error("parse and check config model failed", log.Error(err))
		return nil, err
	}
	ns, name := c.GetNamespace(), config.Name
	config.Namespace = ns
	oldConfig, err := api.Config.Get(ns, name, "")
	if err != nil {
		if e, ok := err.(errors.Coder); !ok || e.Code() != common.ErrResourceNotFound {
			return nil, err
		}
	}
	if oldConfig != nil {
		return nil, common.Error(common.ErrRequestParamInvalid,
			common.Field("error", "this name is already in use"))
	}
	config, err = api.Facade.CreateConfig(ns, config)
	if err != nil {
		return nil, err
	}
	return api.ToConfigurationView(config)
}