@Test public void testCreateNewNetworkInterface() { TestClock clock = Clocks.test(); long timestamp = clock.wallTime(); AgentResourceCacheNetworkInterface networkInterface = AgentResourceCacheFunctions.createNetworkInterface(1, Collections.singletonMap("192.168.1.1", Collections.singleton("sg-1234")), Collections.emptySet(), false, timestamp); Assertions.assertThat(networkInterface).isNotNull(); }
public static AgentResourceCacheNetworkInterface createNetworkInterface(int eniIndex, Map<String, Set<String>> ipAddresses, Set<String> securityGroupIds, boolean hasAvailableIps, long timestamp) { String joinedSecurityGroupIds = StringExt.concatenate(securityGroupIds, SECURITY_GROUP_ID_DELIMITER); return AgentResourceCacheNetworkInterface.newBuilder() .withEniIndex(eniIndex) .withIpAddresses(ipAddresses) .withSecurityGroupIds(securityGroupIds) .withHasAvailableIps(hasAvailableIps) .withTimestamp(timestamp) .build(); }
AgentResourceCacheFunctions { public static AgentResourceCacheNetworkInterface createNetworkInterface(int eniIndex, Map<String, Set<String>> ipAddresses, Set<String> securityGroupIds, boolean hasAvailableIps, long timestamp) { String joinedSecurityGroupIds = StringExt.concatenate(securityGroupIds, SECURITY_GROUP_ID_DELIMITER); return AgentResourceCacheNetworkInterface.newBuilder() .withEniIndex(eniIndex) .withIpAddresses(ipAddresses) .withSecurityGroupIds(securityGroupIds) .withHasAvailableIps(hasAvailableIps) .withTimestamp(timestamp) .build(); } }
AgentResourceCacheFunctions { public static AgentResourceCacheNetworkInterface createNetworkInterface(int eniIndex, Map<String, Set<String>> ipAddresses, Set<String> securityGroupIds, boolean hasAvailableIps, long timestamp) { String joinedSecurityGroupIds = StringExt.concatenate(securityGroupIds, SECURITY_GROUP_ID_DELIMITER); return AgentResourceCacheNetworkInterface.newBuilder() .withEniIndex(eniIndex) .withIpAddresses(ipAddresses) .withSecurityGroupIds(securityGroupIds) .withHasAvailableIps(hasAvailableIps) .withTimestamp(timestamp) .build(); }  }
AgentResourceCacheFunctions { public static AgentResourceCacheNetworkInterface createNetworkInterface(int eniIndex, Map<String, Set<String>> ipAddresses, Set<String> securityGroupIds, boolean hasAvailableIps, long timestamp) { String joinedSecurityGroupIds = StringExt.concatenate(securityGroupIds, SECURITY_GROUP_ID_DELIMITER); return AgentResourceCacheNetworkInterface.newBuilder() .withEniIndex(eniIndex) .withIpAddresses(ipAddresses) .withSecurityGroupIds(securityGroupIds) .withHasAvailableIps(hasAvailableIps) .withTimestamp(timestamp) .build(); }  static AgentResourceCacheNetworkInterface createNetworkInterface(int eniIndex, Map<String, Set<String>> ipAddresses,
                                                                            Set<String> securityGroupIds, boolean hasAvailableIps, long timestamp); static AgentResourceCacheNetworkInterface updateNetworkInterface(AgentResourceCacheNetworkInterface original,
                                                                            AgentResourceCacheNetworkInterface updated); static Map<Integer, AgentResourceCacheNetworkInterface> updateNetworkInterface(Map<Integer, AgentResourceCacheNetworkInterface> original,
                                                                                          Map<Integer, AgentResourceCacheNetworkInterface> updated); static AgentResourceCacheImage createImage(String imageName, String imageDigest, String imageTag); static AgentResourceCacheInstance createInstance(String hostname,
                                                            Set<AgentResourceCacheImage> images,
                                                            Map<Integer, AgentResourceCacheNetworkInterface> networkInterfaces); static AgentResourceCacheImage getImage(TaskRequest taskRequest); static AgentResourceCacheInstance createInstance(String hostname,
                                                            TaskRequest request,
                                                            ConsumeResult consumeResult,
                                                            long timestamp); static AgentResourceCacheInstance createInstance(String hostname, Job job, Task task, long timestamp); static AgentResourceCacheImage createImage(Job job); static AgentResourceCacheNetworkInterface createNetworkInterface(Job job, Task task, int eniIndex, long timestamp); static AgentResourceCacheInstance updateInstance(AgentResourceCacheInstance original, AgentResourceCacheInstance updated); static AgentResourceCacheInstance removeTaskFromInstance(AgentResourceCacheInstance instance, Task task, long timestamp); static AgentResourceCacheNetworkInterface removeTaskIdFromNetworkInterface(String taskId,
                                                                                      String ipAddress,
                                                                                      AgentResourceCacheNetworkInterface networkInterface,
                                                                                      long timestamp); }
AgentResourceCacheFunctions { public static AgentResourceCacheNetworkInterface createNetworkInterface(int eniIndex, Map<String, Set<String>> ipAddresses, Set<String> securityGroupIds, boolean hasAvailableIps, long timestamp) { String joinedSecurityGroupIds = StringExt.concatenate(securityGroupIds, SECURITY_GROUP_ID_DELIMITER); return AgentResourceCacheNetworkInterface.newBuilder() .withEniIndex(eniIndex) .withIpAddresses(ipAddresses) .withSecurityGroupIds(securityGroupIds) .withHasAvailableIps(hasAvailableIps) .withTimestamp(timestamp) .build(); }  static AgentResourceCacheNetworkInterface createNetworkInterface(int eniIndex, Map<String, Set<String>> ipAddresses,
                                                                            Set<String> securityGroupIds, boolean hasAvailableIps, long timestamp); static AgentResourceCacheNetworkInterface updateNetworkInterface(AgentResourceCacheNetworkInterface original,
                                                                            AgentResourceCacheNetworkInterface updated); static Map<Integer, AgentResourceCacheNetworkInterface> updateNetworkInterface(Map<Integer, AgentResourceCacheNetworkInterface> original,
                                                                                          Map<Integer, AgentResourceCacheNetworkInterface> updated); static AgentResourceCacheImage createImage(String imageName, String imageDigest, String imageTag); static AgentResourceCacheInstance createInstance(String hostname,
                                                            Set<AgentResourceCacheImage> images,
                                                            Map<Integer, AgentResourceCacheNetworkInterface> networkInterfaces); static AgentResourceCacheImage getImage(TaskRequest taskRequest); static AgentResourceCacheInstance createInstance(String hostname,
                                                            TaskRequest request,
                                                            ConsumeResult consumeResult,
                                                            long timestamp); static AgentResourceCacheInstance createInstance(String hostname, Job job, Task task, long timestamp); static AgentResourceCacheImage createImage(Job job); static AgentResourceCacheNetworkInterface createNetworkInterface(Job job, Task task, int eniIndex, long timestamp); static AgentResourceCacheInstance updateInstance(AgentResourceCacheInstance original, AgentResourceCacheInstance updated); static AgentResourceCacheInstance removeTaskFromInstance(AgentResourceCacheInstance instance, Task task, long timestamp); static AgentResourceCacheNetworkInterface removeTaskIdFromNetworkInterface(String taskId,
                                                                                      String ipAddress,
                                                                                      AgentResourceCacheNetworkInterface networkInterface,
                                                                                      long timestamp); static final String SECURITY_GROUP_ID_DELIMITER; static final String EMPTY_JOINED_SECURITY_GROUP_IDS; static final String EMPTY_IP_ADDRESS; }