@Test void testResolveCredentials() { var account = new AwsAccount(); account.setAccessKeyId("my-key-id"); account.setSecretAccessKey("my-secret"); account.setAutoDiscovered(false); var credentials = account.resolveCredentials(); assertNotNull(credentials); assertEquals("my-key-id", credentials.accessKeyId()); assertEquals("my-secret", credentials.secretAccessKey()); account = new AwsAccount(); account.setAutoDiscovered(true); System.setProperty("aws.accessKeyId", "my-discovered-key-id"); System.setProperty("aws.secretAccessKey", "my-discovered-secret"); assertTrue(account.isAutoDiscovered()); credentials = account.resolveCredentials(); assertNotNull(credentials); assertEquals("my-discovered-key-id", credentials.accessKeyId()); assertEquals("my-discovered-secret", credentials.secretAccessKey()); }
@Override public AwsCredentials resolveCredentials() { if (this.isAutoDiscovered()) { return DEFAULT_PROVIDER.resolveCredentials(); } return this; }
AwsAccount extends CloudAccount<AwsCredentials> implements AwsCredentials, AwsCredentialsProvider { @Override public AwsCredentials resolveCredentials() { if (this.isAutoDiscovered()) { return DEFAULT_PROVIDER.resolveCredentials(); } return this; } }
AwsAccount extends CloudAccount<AwsCredentials> implements AwsCredentials, AwsCredentialsProvider { @Override public AwsCredentials resolveCredentials() { if (this.isAutoDiscovered()) { return DEFAULT_PROVIDER.resolveCredentials(); } return this; }  }
AwsAccount extends CloudAccount<AwsCredentials> implements AwsCredentials, AwsCredentialsProvider { @Override public AwsCredentials resolveCredentials() { if (this.isAutoDiscovered()) { return DEFAULT_PROVIDER.resolveCredentials(); } return this; }  @Override void validate(); static AwsAccount discover(); @Override AwsCredentials resolveCredentials(); @Override String accessKeyId(); @Override String secretAccessKey(); String getRegion(); void setAccessKeyId(String accessKeyId); void setSecretAccessKey(String secretAccessKey); }
AwsAccount extends CloudAccount<AwsCredentials> implements AwsCredentials, AwsCredentialsProvider { @Override public AwsCredentials resolveCredentials() { if (this.isAutoDiscovered()) { return DEFAULT_PROVIDER.resolveCredentials(); } return this; }  @Override void validate(); static AwsAccount discover(); @Override AwsCredentials resolveCredentials(); @Override String accessKeyId(); @Override String secretAccessKey(); String getRegion(); void setAccessKeyId(String accessKeyId); void setSecretAccessKey(String secretAccessKey);  }