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());
}
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());
}
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);
}
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;
}
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;
}
Aggregations