Use Multimap bindings to construct BigQuery schema map

This refactoring allows the schemas to live in the same package they
are used, rather than all having to be inside the bigquery package.
This is a follow-up to []
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120551011
This commit is contained in:
mcilwain 2016-04-22 08:44:42 -07:00 committed by Justine Tunney
parent d65bf2a714
commit e14faaa7e6
9 changed files with 143 additions and 125 deletions

View file

@ -14,14 +14,30 @@
package com.google.domain.registry.monitoring.whitebox;
import com.google.domain.registry.bigquery.BigquerySchemas;
import com.google.api.services.bigquery.model.TableFieldSchema;
import com.google.common.collect.ImmutableList;
import com.google.domain.registry.bigquery.BigqueryUtils.FieldType;
import com.google.domain.registry.model.eppoutput.Result.Code;
/** The EPP Metrics collector. See {@link Metrics}. */
public class EppMetrics extends Metrics {
static final String EPPMETRICS_TABLE_ID = "eppMetrics";
static final ImmutableList<TableFieldSchema> EPPMETRICS_SCHEMA_FIELDS =
ImmutableList.of(
new TableFieldSchema().setName("requestId").setType(FieldType.STRING.name()),
new TableFieldSchema().setName("startTime").setType(FieldType.TIMESTAMP.name()),
new TableFieldSchema().setName("endTime").setType(FieldType.TIMESTAMP.name()),
new TableFieldSchema().setName("commandName").setType(FieldType.STRING.name()),
new TableFieldSchema().setName("clientId").setType(FieldType.STRING.name()),
new TableFieldSchema().setName("privilegeLevel").setType(FieldType.STRING.name()),
new TableFieldSchema().setName("eppTarget").setType(FieldType.STRING.name()),
new TableFieldSchema().setName("eppStatus").setType(FieldType.INTEGER.name()),
new TableFieldSchema().setName("attempts").setType(FieldType.INTEGER.name()));
public EppMetrics() {
setTableId(BigquerySchemas.EPPMETRICS_TABLE_ID);
setTableId(EPPMETRICS_TABLE_ID);
fields.put("attempts", 0);
}