def _GetClearedFieldsForCorsPolicy(cors_policy, field_prefix):
  """Gets a list of fields cleared by the user for CorsPolicy."""
  cleared_fields = []
  if not cors_policy.allowOrigins:
    cleared_fields.append(field_prefix + 'allowOrigins')
  if not cors_policy.allowOriginRegexes:
    cleared_fields.append(field_prefix + 'allowOriginRegexes')
  if not cors_policy.allowMethods:
    cleared_fields.append(field_prefix + 'allowMethods')
  if not cors_policy.allowHeaders:
    cleared_fields.append(field_prefix + 'allowHeaders')
  if not cors_policy.exposeHeaders:
    cleared_fields.append(field_prefix + 'exposeHeaders')
  if not cors_policy.maxAge:
    cleared_fields.append(field_prefix + 'maxAge')
  if not cors_policy.allowCredentials:
    cleared_fields.append(field_prefix + 'allowCredentials')
  if not cors_policy.disabled:
    cleared_fields.append(field_prefix + 'disabled')
  return cleared_fields