code: func (*TeleportRoleMarshaler) MarshalRole(r Role, opts ...MarshalOption) ([]byte, error) {
  	cfg, err := collectOptions(opts)
  	if err != nil {
  		return nil, trace.Wrap(err)
  	}
  	switch role := r.(type) {
  	case *RoleV3:
  		if !cfg.PreserveResourceID {
  			// avoid modifying the original object
  			// to prevent unexpected data races
  			copy := *role
  			copy.SetResourceID(0)
  			role = &copy
  		}
  		return utils.FastMarshal(role)
  	default:
  		return nil, trace.BadParameter("unrecognized role version %T", r)
  	}
  }
docs: // MarshalRole marshalls role into JSON.