Search in sources :

Example 1 with ApiLimitMetric

use of com.google.api.server.spi.config.ApiLimitMetric in project endpoints-java by cloudendpoints.

the class ApiAnnotationConfig method setApiLimitMetrics.

public void setApiLimitMetrics(ApiLimitMetric[] apiLimitMetrics) {
    ImmutableList.Builder<ApiLimitMetricConfig> metricConfigs = ImmutableList.builder();
    if (apiLimitMetrics != null && apiLimitMetrics.length > 0) {
        for (ApiLimitMetric metric : apiLimitMetrics) {
            metricConfigs.add(ApiLimitMetricConfig.builder().setName(metric.name()).setDisplayName(metric.displayName()).setLimit(metric.limit()).build());
        }
    }
    config.setApiLimitMetrics(metricConfigs.build());
}
Also used : ApiLimitMetric(com.google.api.server.spi.config.ApiLimitMetric) ImmutableList(com.google.common.collect.ImmutableList) ApiLimitMetricConfig(com.google.api.server.spi.config.model.ApiLimitMetricConfig)

Aggregations

ApiLimitMetric (com.google.api.server.spi.config.ApiLimitMetric)1 ApiLimitMetricConfig (com.google.api.server.spi.config.model.ApiLimitMetricConfig)1 ImmutableList (com.google.common.collect.ImmutableList)1