def METHOD_NAME():
    """Generate and upload GCS metadata."""
    args = parser.parse_args()
    storage_client = storage.Client(args.project_id)
    # set log level
    try:
        logging.basicConfig(level=args.log_level, format="%(levelname)s %(message)s")
    except ValueError as e:
        parser.error(f"argument --log-level: {e}")
    projects = project_dirs()
    all_metadata = []
    for target in projects:
        if os.path.isdir(target):
            gcs_table_metadata = get_public_gcs_table_metadata(
                storage_client,
                args.target_bucket,
                args.api_version,
                args.endpoint,
                target,
            )
            all_metadata += gcs_table_metadata
            publish_table_metadata(
                storage_client, gcs_table_metadata, args.target_bucket
            )
        else:
            print(
                f"Invalid target: {target}, target must be a directory with"
                "structure <project>/<dataset>/<table>/metadata.yaml."
            )
    output_file = f"gs://{args.target_bucket}/all-datasets.json"
    publish_all_datasets_metadata(all_metadata, output_file)
    set_content_type(
        storage_client,
        args.target_bucket,
        "all-datasets.json",
        "application/json",
    )