Skip to content

Commit d67c840

Browse files
committed
refactor: make constants from strings
1 parent 285c84a commit d67c840

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

util/src/main/java/io/kubernetes/client/Metrics.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
public class Metrics {
2626
private static final String API_GROUP = "metrics.k8s.io";
2727
private static final String API_VERSION = "v1beta1";
28+
private static final String PODS = "pods";
29+
private static final String NODES = "nodes";
30+
2831
private ApiClient apiClient;
2932

3033
/** Simple Metrics API constructor, uses default configuration */
@@ -66,7 +69,7 @@ public NodeMetricsList getNodeMetrics() throws ApiException {
6669
NodeMetricsList.class,
6770
Metrics.API_GROUP,
6871
Metrics.API_VERSION,
69-
"nodes",
72+
Metrics.NODES,
7073
apiClient);
7174
return metricsClient.list().throwsApiException().getObject();
7275
}
@@ -85,7 +88,7 @@ public PodMetricsList getPodMetrics(String namespace) throws ApiException {
8588
public PodMetricsList getPodMetrics(String namespace, String labelSelector) throws ApiException {
8689
GenericKubernetesApi<PodMetrics, PodMetricsList> metricsClient =
8790
new GenericKubernetesApi<>(
88-
PodMetrics.class, PodMetricsList.class, Metrics.API_GROUP, Metrics.API_VERSION, "pods", apiClient);
91+
PodMetrics.class, PodMetricsList.class, Metrics.API_GROUP, Metrics.API_VERSION, Metrics.PODS, apiClient);
8992
final ListOptions listOptions = new ListOptions();
9093
listOptions.setLabelSelector(labelSelector);
9194
return metricsClient.list(namespace, listOptions).throwsApiException().getObject();

0 commit comments

Comments
 (0)