Search in sources :

Example 41 with S3CloudStorageV1Parameters

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());
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) HashMap(java.util.HashMap) Features(com.sequenceiq.common.api.telemetry.model.Features) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Monitoring(com.sequenceiq.common.api.telemetry.model.Monitoring) WorkloadAnalytics(com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics) Test(org.junit.Test)

Example 42 with S3CloudStorageV1Parameters

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);
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)

Example 43 with S3CloudStorageV1Parameters

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;
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) WasbCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.WasbCloudStorageV1Parameters) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)

Example 44 with S3CloudStorageV1Parameters

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;
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)

Example 45 with S3CloudStorageV1Parameters

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;
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) WasbCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.WasbCloudStorageV1Parameters) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)

Aggregations

S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)59 Test (org.junit.jupiter.api.Test)27 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)16 Logging (com.sequenceiq.common.api.telemetry.model.Logging)15 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)12 Test (org.junit.Test)12 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)10 SdxCloudStorageRequest (com.sequenceiq.sdx.api.model.SdxCloudStorageRequest)10 StorageIdentityBase (com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)8 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)8 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)7 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)7 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)7 Backup (com.sequenceiq.freeipa.api.model.Backup)7 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)5 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)5 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)5 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)4 Features (com.sequenceiq.common.api.telemetry.model.Features)4 SdxClusterRequest (com.sequenceiq.sdx.api.model.SdxClusterRequest)4