code: func UnmarshalServerResource(data []byte, kind string, cfg *MarshalConfig) (Server, error) {
  	if len(data) == 0 {
  		return nil, trace.BadParameter("missing server data")
  	}
  
  	var h ResourceHeader
  	err := utils.FastUnmarshal(data, &h)
  	if err != nil {
  		return nil, trace.Wrap(err)
  	}
  
  	switch h.Version {
  	case "":
  		var s ServerV1
  		err := utils.FastUnmarshal(data, &s)
  		if err != nil {
  			return nil, trace.Wrap(err)
  		}
  		s.Kind = kind
  		v2 := s.V2()
  		if cfg.ID != 0 {
  			v2.SetResourceID(cfg.ID)
  		}
  		if !cfg.Expires.IsZero() {
  			v2.SetExpiry(cfg.Expires)
  		}
  		return v2, nil
  	case V2:
  		var s ServerV2
  
  		if cfg.SkipValidation {
  			if err := utils.FastUnmarshal(data, &s); err != nil {
  				return nil, trace.BadParameter(err.Error())
  			}
  		} else {
  			if err := utils.UnmarshalWithSchema(GetServerSchema(), &s, data); err != nil {
  				return nil, trace.BadParameter(err.Error())
  			}
  		}
  		s.Kind = kind
  		if err := s.CheckAndSetDefaults(); err != nil {
  			return nil, trace.Wrap(err)
  		}
  		if cfg.ID != 0 {
  			s.SetResourceID(cfg.ID)
  		}
  		if !cfg.Expires.IsZero() {
  			s.SetExpiry(cfg.Expires)
  		}
  		return &s, nil
  	}
  	return nil, trace.BadParameter("server resource version %q is not supported", h.Version)
  }
docs: // UnmarshalServerResource unmarshals role from JSON or YAML,
  // sets defaults and checks the schema