docs: def UploadArtifactYamlFile(file_content,
                             overwrite=True,
                             overwrite_system_artifacts=False):
    """Upload a yaml or json file as an artifact to the datastore."""
    loaded_artifacts = []
    registry_obj = artifact_registry.REGISTRY
    # Make sure all artifacts are loaded so we don't accidentally overwrite one.
    registry_obj.GetArtifacts(reload_datastore_artifacts=True)
  
    new_artifacts = registry_obj.ArtifactsFromYaml(file_content)
    new_artifact_names = set()
    # A quick syntax check before we upload anything.
    for artifact_value in new_artifacts:
      artifact_registry.ValidateSyntax(artifact_value)
      new_artifact_names.add(artifact_value.name)
  
    # Iterate through each artifact adding it to the collection.
    artifact_coll = artifact_registry.ArtifactCollection(ARTIFACT_STORE_ROOT_URN)
    current_artifacts = list(artifact_coll)
  
    # We need to remove artifacts we are overwriting.
    filtered_artifacts = [
        art for art in current_artifacts if art.name not in new_artifact_names
    ]
  
    artifact_coll.Delete()
    with data_store.DB.GetMutationPool() as pool:
      for artifact_value in filtered_artifacts:
        artifact_coll.Add(artifact_value, mutation_pool=pool)
  
      for artifact_value in new_artifacts:
        registry_obj.RegisterArtifact(
            artifact_value,
            source="datastore:%s" % ARTIFACT_STORE_ROOT_URN,
            overwrite_if_exists=overwrite,
            overwrite_system_artifacts=overwrite_system_artifacts)
  
        artifact_coll.Add(artifact_value, mutation_pool=pool)
        if data_store.RelationalDBEnabled():
          data_store.REL_DB.WriteArtifact(artifact_value)
  
        loaded_artifacts.append(artifact_value)
  
        name = artifact_value.name
        logging.info("Uploaded artifact %s to %s", name, ARTIFACT_STORE_ROOT_URN)
  
    # Once all artifacts are loaded we can validate dependencies. Note that we do
    # not have to perform a syntax validation because it is already done after
    # YAML is parsed.
    for artifact_value in loaded_artifacts:
      artifact_registry.ValidateDependencies(artifact_value)