diff --git a/kayenta-core/src/main/java/com/netflix/kayenta/retrofit/config/RetrofitClientFactory.java b/kayenta-core/src/main/java/com/netflix/kayenta/retrofit/config/RetrofitClientFactory.java index 94ed9b262..ab2952c44 100644 --- a/kayenta-core/src/main/java/com/netflix/kayenta/retrofit/config/RetrofitClientFactory.java +++ b/kayenta-core/src/main/java/com/netflix/kayenta/retrofit/config/RetrofitClientFactory.java @@ -126,7 +126,7 @@ public T createClient( String password, String usernamePasswordFile, String bearerToken, - String apiKey) + String apiToken) throws IOException { String baseUrl = remoteService.getBaseUrl(); @@ -138,9 +138,10 @@ public T createClient( && StringUtils.isEmpty(password) && StringUtils.isEmpty(usernamePasswordFile) && StringUtils.isEmpty(bearerToken) - && StringUtils.isEmpty(apiKey))) { + && StringUtils.isEmpty(apiToken))) { okHttpClient = - createAuthenticatedClient(username, password, usernamePasswordFile, bearerToken, apiKey); + createAuthenticatedClient( + username, password, usernamePasswordFile, bearerToken, apiToken); } Slf4jRetrofitLogger logger = createRetrofitLogger.apply(type); @@ -161,7 +162,7 @@ private static OkHttpClient createAuthenticatedClient( String password, String usernamePasswordFile, String bearerToken, - String apiKey) + String apiToken) throws IOException { final String credential; @@ -172,8 +173,8 @@ private static OkHttpClient createAuthenticatedClient( credential = "Basic " + Base64.encodeBase64String(trimmedFileContent.getBytes()); } else if (StringUtils.isNotEmpty(bearerToken)) { credential = "Bearer " + bearerToken; - } else if (StringUtils.isNotEmpty(apiKey)) { - credential = "Token " + apiKey; + } else if (StringUtils.isNotEmpty(apiToken)) { + credential = "Token " + apiToken; } else { credential = Credentials.basic(username, password); } diff --git a/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/config/InfluxDbConfiguration.java b/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/config/InfluxDbConfiguration.java index f9aab9a78..590903a3a 100644 --- a/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/config/InfluxDbConfiguration.java +++ b/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/config/InfluxDbConfiguration.java @@ -71,7 +71,7 @@ MetricsService influxDbMetricsService( List supportedTypes = account.getSupportedTypes(); InfluxdbCredentials credentials = - InfluxdbCredentials.builder().apiKey(account.getApiKey()).build(); + InfluxdbCredentials.builder().apiToken(account.getApiKey()).build(); InfluxDbNamedAccountCredentials.InfluxDbNamedAccountCredentialsBuilder accountCredentialsBuilder = @@ -92,7 +92,7 @@ MetricsService influxDbMetricsService( null, null, null, - account.getApiKey())); + credentials.getApiToken())); } accountCredentialsBuilder.supportedTypes(supportedTypes); } diff --git a/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/security/InfluxdbCredentials.java b/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/security/InfluxdbCredentials.java index 98e32ee11..2ce6d2f6c 100644 --- a/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/security/InfluxdbCredentials.java +++ b/kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/security/InfluxdbCredentials.java @@ -28,5 +28,5 @@ public class InfluxdbCredentials { .orElse("Unknown"); private String dbName; - private String apiKey; + private String apiToken; }