refactor(cats): Make the AgentDataType constructor private
just a tiny semi-pointless cleanup
MODIFY
cats/cats-core/src/main/java/com/netflix/spinnaker/cats/agent/AgentDataType.java
cats/cats-core/src/main/java/com/netflix/spinnaker/cats/agent/AgentDataType.java
@@ -25,7 +25,7 @@ package com.netflix.spinnaker.cats.agent;
* complete set of data, so will not result in deletions when elements are no longer present.
*/
public class AgentDataType {
- public static enum Authority {
+ public enum Authority {
AUTHORITATIVE,
INFORMATIVE;
@@ -37,7 +37,7 @@ public class AgentDataType {
private final String typeName;
private final Authority authority;
- public AgentDataType(String typeName, Authority authority) {
+ private AgentDataType(String typeName, Authority authority) {
this.typeName = typeName;
this.authority = authority;
}

MODIFY
clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/provider/agent/AmazonInstanceTypeCachingAgent.java
clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/provider/agent/AmazonInstanceTypeCachingAgent.java
package com.netflix.spinnaker.clouddriver.aws.provider.agent;
+import static com.netflix.spinnaker.cats.agent.AgentDataType.Authority.AUTHORITATIVE;
+
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -35,9 +37,21 @@ import com.netflix.spinnaker.clouddriver.security.AccountCredentialsRepository;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
import java.util.stream.Collectors;
-import org.apache.http.*;
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpHead;
@@ -79,9 +93,8 @@ public class AmazonInstanceTypeCachingAgent implements CachingAgent {
public Collection<AgentDataType> getProvidedDataTypes() {
return Collections.unmodifiableList(
Arrays.asList(
- new AgentDataType(
- Keys.Namespace.INSTANCE_TYPES.getNs(), AgentDataType.Authority.AUTHORITATIVE),
- new AgentDataType(getAgentType(), AgentDataType.Authority.AUTHORITATIVE)));
+ AUTHORITATIVE.forType(Keys.Namespace.INSTANCE_TYPES.getNs()),
+ AUTHORITATIVE.forType(getAgentType())));
}
@Override

refactor(cats): Make the AgentDataType constructor private (#3904)

just a tiny semi-pointless cleanup