Search in sources :

Example 1 with AwsS3Storage

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());
}
Also used : AwsS3Storage(io.stackgres.common.crd.storages.AwsS3Storage) BackupConfigReview(io.stackgres.operator.common.BackupConfigReview) JsonPatchOperation(com.github.fge.jsonpatch.JsonPatchOperation) DefaultValuesMutatorTest(io.stackgres.operator.mutation.DefaultValuesMutatorTest) Test(org.junit.jupiter.api.Test)

Example 2 with AwsS3Storage

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));
}
Also used : AwsS3Storage(io.stackgres.common.crd.storages.AwsS3Storage) BackupStorage(io.stackgres.common.crd.storages.BackupStorage) AwsSecretKeySelector(io.stackgres.common.crd.storages.AwsSecretKeySelector) AwsCredentials(io.stackgres.common.crd.storages.AwsCredentials) SecretKeySelector(io.stackgres.common.crd.SecretKeySelector) AzureBlobSecretKeySelector(io.stackgres.common.crd.storages.AzureBlobSecretKeySelector) AwsSecretKeySelector(io.stackgres.common.crd.storages.AwsSecretKeySelector) GoogleCloudSecretKeySelector(io.stackgres.common.crd.storages.GoogleCloudSecretKeySelector)

Aggregations

AwsS3Storage (io.stackgres.common.crd.storages.AwsS3Storage)2 JsonPatchOperation (com.github.fge.jsonpatch.JsonPatchOperation)1 SecretKeySelector (io.stackgres.common.crd.SecretKeySelector)1 AwsCredentials (io.stackgres.common.crd.storages.AwsCredentials)1 AwsSecretKeySelector (io.stackgres.common.crd.storages.AwsSecretKeySelector)1 AzureBlobSecretKeySelector (io.stackgres.common.crd.storages.AzureBlobSecretKeySelector)1 BackupStorage (io.stackgres.common.crd.storages.BackupStorage)1 GoogleCloudSecretKeySelector (io.stackgres.common.crd.storages.GoogleCloudSecretKeySelector)1 BackupConfigReview (io.stackgres.operator.common.BackupConfigReview)1 DefaultValuesMutatorTest (io.stackgres.operator.mutation.DefaultValuesMutatorTest)1 Test (org.junit.jupiter.api.Test)1