use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToRequest.
@Test
public void testConvertToRequest() {
// GIVEN
Telemetry telemetry = new Telemetry();
telemetry.setDatabusEndpoint(DATABUS_ENDPOINT);
Logging logging = new Logging();
logging.setS3(new S3CloudStorageV1Parameters());
telemetry.setLogging(logging);
Monitoring monitoring = new Monitoring();
monitoring.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
telemetry.setMonitoring(monitoring);
Features features = new Features();
features.addClusterLogsCollection(true);
features.addMonitoring(true);
telemetry.setFeatures(features);
WorkloadAnalytics workloadAnalytics = new WorkloadAnalytics();
Map<String, Object> waAttributes = new HashMap<>();
waAttributes.put("myWAKey", "myWAValue");
workloadAnalytics.setAttributes(waAttributes);
telemetry.setWorkloadAnalytics(workloadAnalytics);
Map<String, Object> fluentAttributes = new HashMap<>();
fluentAttributes.put("myKey", "myValue");
telemetry.setFluentAttributes(fluentAttributes);
// WHEN
TelemetryRequest result = underTest.convertToRequest(telemetry);
// THEN
assertNotNull(result.getLogging().getS3());
assertEquals("myValue", result.getFluentAttributes().get("myKey"));
assertEquals("myWAValue", result.getWorkloadAnalytics().getAttributes().get("myWAKey"));
assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
assertTrue(result.getFeatures().getMonitoring().isEnabled());
assertEquals(MONITORING_REMOTE_WRITE_URL, result.getMonitoring().getRemoteWriteUrl());
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class CloudStorageValidator method addLogIdentity.
private void addLogIdentity(CloudStorageRequest cloudStorageRequest, TelemetryRequest telemetryRequest) {
StorageIdentityBase log = new StorageIdentityBase();
log.setType(CloudIdentityType.LOG);
LoggingRequest logging = telemetryRequest.getLogging();
if (logging.getS3() != null) {
log.setS3(logging.getS3());
} else if (logging.getAdlsGen2() != null) {
log.setAdlsGen2(logging.getAdlsGen2());
} else if (logging.getGcs() != null) {
log.setGcs(logging.getGcs());
} else if (logging.getCloudwatch() != null) {
LOGGER.debug("Cloudwatch will act as s3 storage identity!");
S3CloudStorageV1Parameters s3CloudwatchParams = new S3CloudStorageV1Parameters();
s3CloudwatchParams.setInstanceProfile(logging.getCloudwatch().getInstanceProfile());
log.setS3(s3CloudwatchParams);
}
cloudStorageRequest.getIdentities().add(log);
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters 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.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class CloudStorageConverter method s3IdentityToParameters.
private S3CloudStorageV1Parameters s3IdentityToParameters(S3Identity s3Identity) {
S3CloudStorageV1Parameters s3Parameters = new S3CloudStorageV1Parameters();
s3Parameters.setInstanceProfile(s3Identity.getInstanceProfile());
return s3Parameters;
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters 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