module Google::Cloud::Bigquery::External

def self.source_format_for urls, format

Other tags:
    Private: - Determine source_format from inputs
def self.source_format_for urls, format
  val = {
    "avro"                   => "AVRO",
    "bigtable"               => "BIGTABLE",
    "csv"                    => "CSV",
    "backup"                 => "DATASTORE_BACKUP",
    "datastore"              => "DATASTORE_BACKUP",
    "datastore_backup"       => "DATASTORE_BACKUP",
    "sheets"                 => "GOOGLE_SHEETS",
    "google_sheets"          => "GOOGLE_SHEETS",
    "json"                   => "NEWLINE_DELIMITED_JSON",
    "newline_delimited_json" => "NEWLINE_DELIMITED_JSON",
    "orc"                    => "ORC",
    "parquet"                => "PARQUET"
  }[format.to_s.downcase]
  return val unless val.nil?
  Array(urls).each do |url|
    return "AVRO" if url.end_with? ".avro"
    return "BIGTABLE" if url.start_with? "https://googleapis.com/bigtable/projects/"
    return "CSV" if url.end_with? ".csv"
    return "DATASTORE_BACKUP" if url.end_with? ".backup_info"
    return "GOOGLE_SHEETS" if url.start_with? "https://docs.google.com/spreadsheets/"
    return "NEWLINE_DELIMITED_JSON" if url.end_with? ".json"
    return "PARQUET" if url.end_with? ".parquet"
  end
  nil
end