code: func (t *TeleportAuthPreferenceMarshaler) Unmarshal(bytes []byte, opts ...MarshalOption) (AuthPreference, error) {
  	var authPreference AuthPreferenceV2
  
  	if len(bytes) == 0 {
  		return nil, trace.BadParameter("missing resource data")
  	}
  
  	cfg, err := collectOptions(opts)
  	if err != nil {
  		return nil, trace.Wrap(err)
  	}
  
  	if cfg.SkipValidation {
  		if err := utils.FastUnmarshal(bytes, &authPreference); err != nil {
  			return nil, trace.BadParameter(err.Error())
  		}
  	} else {
  		err := utils.UnmarshalWithSchema(GetAuthPreferenceSchema(""), &authPreference, bytes)
  		if err != nil {
  			return nil, trace.BadParameter(err.Error())
  		}
  	}
  	if cfg.ID != 0 {
  		authPreference.SetResourceID(cfg.ID)
  	}
  	if !cfg.Expires.IsZero() {
  		authPreference.SetExpiry(cfg.Expires)
  	}
  	return &authPreference, nil
  }
docs: // Unmarshal unmarshals role from JSON or YAML.