use of io.stackgres.common.crd.storages.AwsS3Storage in project stackgres by ongres.
the class BackupConfigDefaultValuesMutatorTest method givenConfWithAllDefaultsValuesSettledButNotDefaultStorage_shouldNotReturnAnyPatch.
@Test
public void givenConfWithAllDefaultsValuesSettledButNotDefaultStorage_shouldNotReturnAnyPatch() {
BackupConfigReview review = getDefaultReview();
review.getRequest().getObject().getSpec().getStorage().setType("s3");
AwsS3Storage s3 = new AwsS3Storage();
s3.setBucket(review.getRequest().getObject().getSpec().getStorage().getS3Compatible().getBucket());
s3.setPath(review.getRequest().getObject().getSpec().getStorage().getS3Compatible().getPath());
s3.setRegion(review.getRequest().getObject().getSpec().getStorage().getS3Compatible().getRegion());
s3.setStorageClass(review.getRequest().getObject().getSpec().getStorage().getS3Compatible().getStorageClass());
s3.setAwsCredentials(review.getRequest().getObject().getSpec().getStorage().getS3Compatible().getAwsCredentials());
review.getRequest().getObject().getSpec().getStorage().setS3(s3);
review.getRequest().getObject().getSpec().getStorage().setS3Compatible(null);
List<JsonPatchOperation> operators = mutator.mutate(review);
assertEquals(0, operators.size());
}
use of io.stackgres.common.crd.storages.AwsS3Storage in project stackgres by ongres.
the class BackupConfigSourceValidatorTest method setS3Credentials.
private void setS3Credentials(final BackupConfigReview review, String accessKeyIdName, String accessKeyIdKey, String secretAccessKeyName, String secretAccessKeyKey) {
BackupStorage storage = review.getRequest().getObject().getSpec().getStorage();
storage.setType("s3");
storage.setS3(new AwsS3Storage());
storage.getS3().setAwsCredentials(new AwsCredentials());
storage.getS3().getAwsCredentials().setSecretKeySelectors(new AwsSecretKeySelector());
AwsSecretKeySelector awsSecretKeySelector = storage.getS3().getAwsCredentials().getSecretKeySelectors();
awsSecretKeySelector.setAccessKeyId(new SecretKeySelector(accessKeyIdKey, accessKeyIdName));
awsSecretKeySelector.setSecretAccessKey(new SecretKeySelector(secretAccessKeyKey, secretAccessKeyName));
}
Aggregations