Search in sources :

Example 21 with AdlsGen2CloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters in project cloudbreak by hortonworks.

the class EnvironmentLogStorageConfigurationValidatorTest method validateTelemetryStorageConfigAzureWhenConfigValidationSuccess.

@Test
public void validateTelemetryStorageConfigAzureWhenConfigValidationSuccess() {
    when(environment.getCloudPlatform()).thenReturn(CloudConstants.AZURE);
    when(environment.getTelemetry()).thenReturn(telemetry);
    when(telemetry.getLogging()).thenReturn(logging);
    AdlsGen2CloudStorageV1Parameters adlsGen2 = new AdlsGen2CloudStorageV1Parameters();
    adlsGen2.setManagedIdentity("/subscriptions/12345678-1234-0234-8234-123456789123/resourceGroups/test/" + "providers/Microsoft.ManagedIdentity/userAssignedIdentities/cdp-assumer");
    when(logging.getAdlsGen2()).thenReturn(adlsGen2);
    ValidationResult result = underTest.validateTelemetryLoggingStorageConfiguration(environment);
    assertFalse(result.hasError());
}
Also used : AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) Test(org.junit.jupiter.api.Test)

Example 22 with AdlsGen2CloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters in project cloudbreak by hortonworks.

the class EnvironmentLogStorageConfigurationValidatorTest method validateTelemetryStorageConfigAzureWhenConfigValidationFailed.

@Test
public void validateTelemetryStorageConfigAzureWhenConfigValidationFailed() {
    when(environment.getCloudPlatform()).thenReturn(CloudConstants.AZURE);
    when(environment.getTelemetry()).thenReturn(telemetry);
    when(telemetry.getLogging()).thenReturn(logging);
    AdlsGen2CloudStorageV1Parameters adlsGen2 = new AdlsGen2CloudStorageV1Parameters();
    adlsGen2.setManagedIdentity("subscriptions1/a9d4sdfsdfsdf/resource1Groups/test/" + "providers/Microsoft.Network/networkSecurityGroups/default");
    when(logging.getAdlsGen2()).thenReturn(adlsGen2);
    ValidationResult result = underTest.validateTelemetryLoggingStorageConfiguration(environment);
    assertTrue(result.hasError());
}
Also used : AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) Test(org.junit.jupiter.api.Test)

Example 23 with AdlsGen2CloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters in project cloudbreak by hortonworks.

the class CloudStorageValidationUtilTest method testIsCloudStorageConfiguredWhenAdlsGen2NotNull.

@Test
public void testIsCloudStorageConfiguredWhenAdlsGen2NotNull() {
    CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
    StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
    storageIdentityBase.setAdlsGen2(new AdlsGen2CloudStorageV1Parameters());
    cloudStorageRequest.setIdentities(List.of(storageIdentityBase));
    cloudStorageRequest.setLocations(List.of(new StorageLocationBase()));
    boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest);
    Assert.assertTrue(actual);
}
Also used : CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Test(org.junit.Test)

Example 24 with AdlsGen2CloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters in project cloudbreak by hortonworks.

the class CloudStorageConverter method cloudIdentityToStorageIdentityBase.

private StorageIdentityBase cloudIdentityToStorageIdentityBase(CloudIdentity cloudIdentity) {
    StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
    storageIdentityBase.setType(cloudIdentity.getIdentityType());
    if (cloudIdentity.getWasbIdentity() != null) {
        WasbCloudStorageV1Parameters parameters = wasbIdentityToParameters(cloudIdentity.getWasbIdentity());
        storageIdentityBase.setWasb(parameters);
    } else if (cloudIdentity.getS3Identity() != null) {
        S3CloudStorageV1Parameters parameters = s3IdentityToParameters(cloudIdentity.getS3Identity());
        storageIdentityBase.setS3(parameters);
    } else if (cloudIdentity.getAdlsGen2Identity() != null) {
        AdlsGen2CloudStorageV1Parameters adlsGen2CloudStorageV1Parameters = adlsGen2IdentityToParameters(cloudIdentity.getAdlsGen2Identity());
        storageIdentityBase.setAdlsGen2(adlsGen2CloudStorageV1Parameters);
    } else if (cloudIdentity.getGcsIdentity() != null) {
        GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = gcsIdentityToParameters(cloudIdentity.getGcsIdentity());
        storageIdentityBase.setGcs(gcsCloudStorageV1Parameters);
    }
    return storageIdentityBase;
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) WasbCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.WasbCloudStorageV1Parameters) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)

Example 25 with AdlsGen2CloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters in project cloudbreak by hortonworks.

the class CloudStorageConverter method cloudIdentityToRequest.

private StorageIdentityBase cloudIdentityToRequest(CloudIdentity cloudIdentity) {
    StorageIdentityBase storageIdentityRequest = new StorageIdentityBase();
    storageIdentityRequest.setType(cloudIdentity.getIdentityType());
    if (cloudIdentity.getS3Identity() != null) {
        S3CloudStorageV1Parameters s3Parameters = s3IdentityToParameters(cloudIdentity.getS3Identity());
        storageIdentityRequest.setS3(s3Parameters);
    } else if (cloudIdentity.getWasbIdentity() != null) {
        WasbCloudStorageV1Parameters wasbParameters = wasbIdentityToParameters(cloudIdentity.getWasbIdentity());
        storageIdentityRequest.setWasb(wasbParameters);
    } else if (cloudIdentity.getAdlsGen2Identity() != null) {
        AdlsGen2CloudStorageV1Parameters adlsGen2CloudStorageV1Parameters = adlsGen2IdentityToParameters(cloudIdentity.getAdlsGen2Identity());
        storageIdentityRequest.setAdlsGen2(adlsGen2CloudStorageV1Parameters);
    } else if (cloudIdentity.getGcsIdentity() != null) {
        GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = gcsIdentityToParameters(cloudIdentity.getGcsIdentity());
        storageIdentityRequest.setGcs(gcsCloudStorageV1Parameters);
    }
    return storageIdentityRequest;
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) WasbCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.WasbCloudStorageV1Parameters) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)

Aggregations

AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)42 Test (org.junit.Test)15 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)12 Logging (com.sequenceiq.common.api.telemetry.model.Logging)10 Test (org.junit.jupiter.api.Test)9 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)7 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)7 Backup (com.sequenceiq.freeipa.api.model.Backup)6 StorageIdentityBase (com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)5 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)4 CloudAdlsGen2View (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudAdlsGen2View)3 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)3 WasbCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.WasbCloudStorageV1Parameters)3 CloudGcsView (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView)2 CloudS3View (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudS3View)2 BackupRequest (com.sequenceiq.common.api.backup.request.BackupRequest)2 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)2 StackTags (com.sequenceiq.cloudbreak.cloud.model.StackTags)1 CloudFileSystemView (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView)1 AwsInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate)1