use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenEnvironmentIsNullAndCloudStorageRequestIsNot.
@Test
void testConvertWhenEnvironmentIsNullAndCloudStorageRequestIsNot() {
CloudStorageRequest request = new CloudStorageRequest();
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, null);
assertNotNull(result);
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenEnvironmentAndStorageRequestAreNull.
@Test
void testConvertWhenEnvironmentAndStorageRequestAreNull() {
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, null, null);
assertNull(result);
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageDecorator method updateCloudStorageLocations.
public CloudStorageRequest updateCloudStorageLocations(String blueprintName, String clusterName, CloudStorageRequest request, List<SdxClusterResponse> datalakes) {
if (hasDatalake(datalakes)) {
Pair<String, FileSystemType> sdxBaseLocationFileSystemType = getBaseLocationWithFileSystemTypeFromSdx(datalakes.get(0));
Set<ConfigQueryEntry> recommendations = getRecommendations(blueprintName, clusterName, sdxBaseLocationFileSystemType);
if (storageLocationsNotDefined(request)) {
if (request == null) {
request = new CloudStorageRequest();
}
if (request.getLocations() == null) {
request.setLocations(new ArrayList<>());
}
for (ConfigQueryEntry recommendation : recommendations) {
request.getLocations().add(createStorageLocationBaseByTypeAndDefaultPath(recommendation.getType(), recommendation.getDefaultPath()));
}
} else {
Map<CloudStorageCdpService, String> templatedLocations = findLocationsThatContainsTemplatedValue(request);
if (!templatedLocations.isEmpty()) {
LOGGER.info("Cloud storage location(s) has found with template placeholder(s). About to replace them with the recommended one(s).");
Set<ConfigQueryEntry> filtered = filterConfigsWithTemplatePlaceholder(request, recommendations);
Set<ConfigQueryEntry> replaced = queryParameters(filtered, blueprintName, clusterName, sdxBaseLocationFileSystemType);
replaceTemplatedLocationValuesWithFilledValues(request, replaced, templatedLocations);
}
}
}
return request;
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageDecorator method decorate.
public CloudStorageRequest decorate(String blueprintName, String clusterName, CloudStorageRequest request, DetailedEnvironmentResponse environment) {
if (environment != null) {
if (request == null) {
request = new CloudStorageRequest();
}
TelemetryResponse telemetry = environment.getTelemetry();
if (telemetry != null && telemetry.getLogging() != null) {
LoggingResponse logging = telemetry.getLogging();
StorageIdentityBase identity = new StorageIdentityBase();
identity.setType(CloudIdentityType.LOG);
identity.setS3(logging.getS3());
identity.setAdlsGen2(logging.getAdlsGen2());
identity.setGcs(logging.getGcs());
List<StorageIdentityBase> identities = request.getIdentities();
if (identities == null) {
identities = new ArrayList<>();
}
boolean logConfiguredInRequest = false;
for (StorageIdentityBase identityBase : identities) {
if (CloudIdentityType.LOG.equals(identityBase.getType())) {
logConfiguredInRequest = true;
}
}
if (!logConfiguredInRequest) {
identities.add(identity);
}
request.setIdentities(identities);
}
List<SdxClusterResponse> datalakes = sdxClientService.getByEnvironmentCrn(environment.getCrn());
updateCloudStorageLocations(blueprintName, clusterName, request, datalakes);
updateDynamoDBTable(request, environment);
}
return request;
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method testAddAzureIdbrokerMsiToTelemetry.
@Test
public void testAddAzureIdbrokerMsiToTelemetry() {
Map<String, Object> attributes = new HashMap<>();
CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
List<StorageIdentityBase> identities = new ArrayList<>();
StorageIdentityBase identity = new StorageIdentityBase();
identity.setType(CloudIdentityType.ID_BROKER);
AdlsGen2CloudStorageV1Parameters adlsGen2 = new AdlsGen2CloudStorageV1Parameters();
adlsGen2.setManagedIdentity("msi");
identity.setAdlsGen2(adlsGen2);
identities.add(identity);
cloudStorageRequest.setIdentities(identities);
when(stackV4Request.getCluster()).thenReturn(clusterV4Request);
clusterV4Request.setCloudStorage(cloudStorageRequest);
underTest.addAzureIdbrokerMsiToTelemetry(attributes, stackV4Request);
assertThat(clusterV4Request.getCloudStorage()).isNotNull();
assertThat(attributes.get(FluentConfigView.AZURE_IDBROKER_INSTANCE_MSI)).isEqualTo("msi");
}
Aggregations