use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithoutWAInput.
@Test
public void testConvertFromEnvAndSdxResponseWithoutWAInput() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
LoggingResponse loggingResponse = new LoggingResponse();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
loggingResponse.setS3(s3Params);
response.setLogging(loggingResponse);
SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
sdxClusterResponse.setName("sdxName");
// WHEN
TelemetryRequest result = underTest.convert(response, sdxClusterResponse);
// THEN
assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
assertEquals("sdxId", result.getWorkloadAnalytics().getAttributes().get("databus.header.sdx.id").toString());
assertEquals("sdxName", result.getWorkloadAnalytics().getAttributes().get("databus.header.sdx.name").toString());
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class TelemetryApiConverter method createLoggingResponseFromSource.
private LoggingResponse createLoggingResponseFromSource(EnvironmentLogging logging) {
LoggingResponse loggingResponse = null;
if (logging != null) {
loggingResponse = new LoggingResponse();
loggingResponse.setStorageLocation(logging.getStorageLocation());
loggingResponse.setS3(convertS3(logging.getS3()));
loggingResponse.setAdlsGen2(convertAdlsV2(logging.getAdlsGen2()));
loggingResponse.setGcs(convertGcs(logging.getGcs()));
loggingResponse.setCloudwatch(CloudwatchParams.copy(logging.getCloudwatch()));
}
return loggingResponse;
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenCloudStorageLocationsIsNullAndEnvironmentHasTelemetryWithLogging.
@Test
void testConvertWhenCloudStorageLocationsIsNullAndEnvironmentHasTelemetryWithLogging() {
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
TelemetryResponse telemetry = new TelemetryResponse();
telemetry.setLogging(new LoggingResponse());
environment.setTelemetry(telemetry);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, null, environment);
assertNotNull(result);
assertTrue(result.getIdentities().stream().anyMatch(id -> CloudIdentityType.LOG.equals(id.getType())));
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse 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.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class CloudStorageManifesterTest method whenEnvironmentHasOnlyLoggingEnabledThenShouldApplyAsLogIdentityForGCS.
@Test
public void whenEnvironmentHasOnlyLoggingEnabledThenShouldApplyAsLogIdentityForGCS() {
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
environment.setCloudPlatform("GCP");
TelemetryResponse telemetryResponse = new TelemetryResponse();
LoggingResponse loggingResponse = new LoggingResponse();
GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
gcsCloudStorageV1Parameters.setServiceAccountEmail(EMAIL);
loggingResponse.setGcs(gcsCloudStorageV1Parameters);
telemetryResponse.setLogging(loggingResponse);
environment.setTelemetry(telemetryResponse);
ClusterV4Request clusterV4Request = new ClusterV4Request();
clusterV4Request.setBlueprintName(exampleBlueprintName);
CloudStorageRequest cloudStorageConfigReq = underTest.initCloudStorageRequest(environment, clusterV4Request, null, new SdxClusterRequest());
assertEquals(1, cloudStorageConfigReq.getIdentities().size());
assertEquals(1, cloudStorageConfigReq.getIdentities().stream().filter(r -> r.getType().equals(CloudIdentityType.LOG)).collect(Collectors.toSet()).size());
assertEquals(EMAIL, cloudStorageConfigReq.getIdentities().get(0).getGcs().getServiceAccountEmail());
}
Aggregations