@Test public void ec2InPrincipals() { assertThat(awsInstanceProfileEC2TrustValidator.checkEC2InPrincipals(Collections.singletonList( new Principal("Service", Services.AmazonEC2.getServiceId())))).isTrue(); assertThat(awsInstanceProfileEC2TrustValidator.checkEC2InPrincipals( Arrays.asList( Principal.AllServices, new Principal("Service", Services.AmazonEC2.getServiceId()) ))).isTrue(); }
boolean checkEC2InPrincipals(List<Principal> principals) { return principals .stream() .anyMatch(principal -> "Service".equals(principal.getProvider()) && Services.AmazonEC2.getServiceId().equals(principal.getId())); }
AwsInstanceProfileEC2TrustValidator { boolean checkEC2InPrincipals(List<Principal> principals) { return principals .stream() .anyMatch(principal -> "Service".equals(principal.getProvider()) && Services.AmazonEC2.getServiceId().equals(principal.getId())); } }
AwsInstanceProfileEC2TrustValidator { boolean checkEC2InPrincipals(List<Principal> principals) { return principals .stream() .anyMatch(principal -> "Service".equals(principal.getProvider()) && Services.AmazonEC2.getServiceId().equals(principal.getId())); }  }
AwsInstanceProfileEC2TrustValidator { boolean checkEC2InPrincipals(List<Principal> principals) { return principals .stream() .anyMatch(principal -> "Service".equals(principal.getProvider()) && Services.AmazonEC2.getServiceId().equals(principal.getId())); }  boolean isTrusted(InstanceProfile instanceProfile, ValidationResultBuilder resultBuilder); }
AwsInstanceProfileEC2TrustValidator { boolean checkEC2InPrincipals(List<Principal> principals) { return principals .stream() .anyMatch(principal -> "Service".equals(principal.getProvider()) && Services.AmazonEC2.getServiceId().equals(principal.getId())); }  boolean isTrusted(InstanceProfile instanceProfile, ValidationResultBuilder resultBuilder);  }