use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class CloudStorageManifesterTest method whenCloudStorageEnabledFromInternalRequestWithLogging.
@Test
public void whenCloudStorageEnabledFromInternalRequestWithLogging() {
ClusterV4Request clusterV4Request = new ClusterV4Request();
clusterV4Request.setBlueprintName(exampleBlueprintName);
CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
StorageLocationBase storageLocationBase = new StorageLocationBase();
storageLocationBase.setType(CloudStorageCdpService.RANGER_AUDIT);
storageLocationBase.setValue("s3a://ranger-audit");
cloudStorageRequest.setLocations(List.of(storageLocationBase));
clusterV4Request.setCloudStorage(cloudStorageRequest);
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
environment.setCloudPlatform("AWS");
TelemetryResponse telemetryResponse = new TelemetryResponse();
LoggingResponse loggingResponse = new LoggingResponse();
S3CloudStorageV1Parameters s3CloudStorageV1Parameters = new S3CloudStorageV1Parameters();
s3CloudStorageV1Parameters.setInstanceProfile("logprofile");
loggingResponse.setS3(s3CloudStorageV1Parameters);
telemetryResponse.setLogging(loggingResponse);
environment.setTelemetry(telemetryResponse);
CloudStorageRequest cloudStorageConfigReq = underTest.initCloudStorageRequest(environment, clusterV4Request, null, new SdxClusterRequest());
assertEquals(CloudStorageCdpService.RANGER_AUDIT, cloudStorageConfigReq.getLocations().get(0).getType());
assertEquals(CloudIdentityType.LOG, cloudStorageConfigReq.getIdentities().get(0).getType());
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class CloudStorageValidationServiceTest method getEnvironment.
private DetailedEnvironmentResponse getEnvironment() {
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
TelemetryResponse telemetry = new TelemetryResponse();
FeaturesResponse features = new FeaturesResponse();
FeatureSetting featureSetting = new FeatureSetting();
featureSetting.setEnabled(true);
features.setCloudStorageLogging(featureSetting);
telemetry.setFeatures(features);
LoggingResponse logging = new LoggingResponse();
logging.setS3(new S3CloudStorageV1Parameters());
telemetry.setLogging(logging);
environment.setTelemetry(telemetry);
return environment;
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class StackRequestManifester method prepareTelemetryForStack.
private void prepareTelemetryForStack(StackV4Request stackV4Request, DetailedEnvironmentResponse environment, SdxCluster sdxCluster) {
TelemetryResponse envTelemetry = environment.getTelemetry();
if (envTelemetry != null && envTelemetry.getLogging() != null) {
TelemetryRequest telemetryRequest = new TelemetryRequest();
LoggingRequest loggingRequest = new LoggingRequest();
LoggingResponse envLogging = envTelemetry.getLogging();
loggingRequest.setS3(envLogging.getS3());
loggingRequest.setAdlsGen2(envLogging.getAdlsGen2());
loggingRequest.setGcs(envLogging.getGcs());
loggingRequest.setCloudwatch(envLogging.getCloudwatch());
loggingRequest.setStorageLocation(envLogging.getStorageLocation());
telemetryRequest.setLogging(loggingRequest);
MonitoringRequest monitoringRequest = new MonitoringRequest();
MonitoringResponse envMonitoring = envTelemetry.getMonitoring();
if (envMonitoring != null) {
monitoringRequest.setRemoteWriteUrl(envMonitoring.getRemoteWriteUrl());
}
telemetryRequest.setMonitoring(monitoringRequest);
if (envTelemetry.getFeatures() != null) {
FeaturesRequest featuresRequest = new FeaturesRequest();
featuresRequest.setClusterLogsCollection(envTelemetry.getFeatures().getClusterLogsCollection());
featuresRequest.setMonitoring(envTelemetry.getFeatures().getMonitoring());
if (envTelemetry.getFeatures().getCloudStorageLogging() != null) {
featuresRequest.setCloudStorageLogging(envTelemetry.getFeatures().getCloudStorageLogging());
} else {
featuresRequest.addCloudStorageLogging(true);
}
telemetryRequest.setFeatures(featuresRequest);
}
if (envTelemetry.getFluentAttributes() != null) {
Map<String, Object> fluentAttributes = envTelemetry.getFluentAttributes();
if (!fluentAttributes.containsKey(TelemetryClusterDetails.CLUSTER_CRN_KEY)) {
fluentAttributes.put(TelemetryClusterDetails.CLUSTER_CRN_KEY, sdxCluster.getCrn());
}
addAzureIdbrokerMsiToTelemetry(fluentAttributes, stackV4Request);
telemetryRequest.setFluentAttributes(fluentAttributes);
}
stackV4Request.setTelemetry(telemetryRequest);
}
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class EnvironmentClientServiceTest method testSdxLogLocationOnUpgradeRequestEnabled.
@Test
public void testSdxLogLocationOnUpgradeRequestEnabled() {
LoggingResponse loggingResponse = new LoggingResponse();
loggingResponse.setStorageLocation(LOG_LOCATION);
TelemetryResponse telemetryResponse = new TelemetryResponse();
telemetryResponse.setLogging(loggingResponse);
DetailedEnvironmentResponse environmentResponse = new DetailedEnvironmentResponse();
environmentResponse.setCloudPlatform(CLOUD_PLATFORM);
environmentResponse.setTelemetry(telemetryResponse);
environmentResponse.setAzure(AzureEnvironmentParameters.builder().withAzureResourceGroup(AzureResourceGroup.builder().withResourceGroupUsage(ResourceGroupUsage.MULTIPLE).build()).build());
when(environmentEndpoint.getByCrn(anyString())).thenReturn(environmentResponse);
Assert.assertEquals(LOG_LOCATION, underTest.getBackupLocation(ENV_CRN));
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenIdentityIsSetToNull.
@Test
void testConvertWhenIdentityIsSetToNull() {
CloudStorageRequest request = new CloudStorageRequest();
request.setIdentities(null);
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
TelemetryResponse telemetry = new TelemetryResponse();
telemetry.setLogging(new LoggingResponse());
environment.setTelemetry(telemetry);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, environment);
assertNotNull(result);
assertEquals(1, result.getIdentities().size());
}
Aggregations