Search in sources :

Example 1 with ClusterV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request in project cloudbreak by hortonworks.

the class ClusterV2RequestToClusterRequestConverter method convert.

@Override
public ClusterRequest convert(ClusterV2Request source) {
    ClusterRequest cluster = new ClusterRequest();
    cluster.setExecutorType(source.getExecutorType());
    cluster.setEmailNeeded(source.getEmailNeeded());
    cluster.setEmailTo(source.getEmailTo());
    cluster.setFileSystem(source.getFileSystem());
    cluster.setName(source.getName());
    if (source.getRdsConfigNames() != null && !source.getRdsConfigNames().isEmpty()) {
        cluster.setRdsConfigNames(source.getRdsConfigNames());
    }
    cluster.setProxyName(source.getProxyName());
    cluster.setLdapConfigName(source.getLdapConfigName());
    AmbariV2Request ambariRequest = source.getAmbari();
    if (ambariRequest != null) {
        cluster.setAmbariDatabaseDetails(ambariRequest.getAmbariDatabaseDetails());
        cluster.setAmbariRepoDetailsJson(ambariRequest.getAmbariRepoDetailsJson());
        cluster.setAmbariStackDetails(ambariRequest.getAmbariStackDetails());
        cluster.setBlueprintCustomPropertiesAsString(ambariRequest.getBlueprintCustomProperties());
        cluster.setBlueprintId(ambariRequest.getBlueprintId());
        cluster.setBlueprintName(ambariRequest.getBlueprintName());
        cluster.setBlueprintInputs(ambariRequest.getBlueprintInputs());
        cluster.setConfigStrategy(ambariRequest.getConfigStrategy());
        cluster.setConnectedCluster(ambariRequest.getConnectedCluster());
        cluster.setEnableSecurity(ambariRequest.getEnableSecurity());
        cluster.setGateway(ambariRequest.getGateway());
        cluster.setKerberos(ambariRequest.getKerberos());
        cluster.setPassword(ambariRequest.getPassword());
        cluster.setUserName(ambariRequest.getUserName());
        cluster.setValidateBlueprint(ambariRequest.getValidateBlueprint());
        cluster.setAmbariSecurityMasterKey(ambariRequest.getAmbariSecurityMasterKey());
    }
    cluster.setHostGroups(new HashSet<>());
    return cluster;
}
Also used : AmbariV2Request(com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request) ClusterRequest(com.sequenceiq.cloudbreak.api.model.ClusterRequest)

Example 2 with ClusterV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request in project cloudbreak by hortonworks.

the class ClusterToClusterV2RequestConverter method convert.

@Override
public ClusterV2Request convert(Cluster source) {
    ClusterV2Request clusterV2Request = new ClusterV2Request();
    clusterV2Request.setAmbari(getConversionService().convert(source, AmbariV2Request.class));
    clusterV2Request.setEmailNeeded(source.getEmailNeeded());
    clusterV2Request.setEmailTo(source.getEmailTo());
    clusterV2Request.setExecutorType(null);
    clusterV2Request.setFileSystem(getConversionService().convert(source.getFileSystem(), FileSystemRequest.class));
    clusterV2Request.setLdapConfigName(source.getLdapConfig() == null ? null : source.getLdapConfig().getName());
    clusterV2Request.setName(source.getName());
    if (source.getRdsConfigs() != null && !source.getRdsConfigs().isEmpty()) {
        Set<String> rdsConfigNames = source.getRdsConfigs().stream().map(RDSConfig::getName).collect(Collectors.toSet());
        clusterV2Request.setRdsConfigNames(Collections.unmodifiableSet(rdsConfigNames));
    }
    if (source.getProxyConfig() != null) {
        clusterV2Request.setProxyName(source.getProxyConfig().getName());
    }
    return clusterV2Request;
}
Also used : FileSystemRequest(com.sequenceiq.cloudbreak.api.model.FileSystemRequest) AmbariV2Request(com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request) ClusterV2Request(com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request)

Example 3 with ClusterV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request in project cloudbreak by hortonworks.

the class AbstractStackCreationV2Test method ambariParameters.

@BeforeMethod(dependsOnGroups = "V2StackCreationInit")
@Parameters({ "blueprintName", "enableSecurity", "kerberosMasterKey", "kerberosAdmin", "kerberosPassword" })
public void ambariParameters(@Optional("") String blueprintName, @Optional("false") boolean enableSecurity, @Optional String kerberosMasterKey, @Optional String kerberosAdmin, @Optional String kerberosPassword) {
    IntegrationTestContext itContext = getItContext();
    blueprintName = StringUtils.hasText(blueprintName) ? blueprintName : itContext.getContextParam(CloudbreakV2Constants.SSH_PUBLICKEY_ID);
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID), "Ambari user is mandatory.");
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID), "Ambari password is mandatory.");
    Assert.assertNotNull(blueprintName, "blueprint name is mandatory.");
    StackV2Request stackV2Request = itContext.getContextParam(CloudbreakV2Constants.STACK_CREATION_REQUEST, StackV2Request.class);
    ClusterV2Request clusterV2Request = new ClusterV2Request();
    stackV2Request.setCluster(clusterV2Request);
    AmbariV2Request ambariV2Request = new AmbariV2Request();
    clusterV2Request.setAmbari(ambariV2Request);
    ambariV2Request.setBlueprintName(blueprintName);
    ambariV2Request.setUserName(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID));
    ambariV2Request.setPassword(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID));
    GatewayJson gatewayJson = new GatewayJson();
    gatewayJson.setEnableGateway(Boolean.FALSE);
    gatewayJson.setExposedServices(ImmutableList.of("ALL"));
    ambariV2Request.setGateway(gatewayJson);
    if (enableSecurity) {
        ambariV2Request.setEnableSecurity(enableSecurity);
        KerberosRequest kerberosRequest = new KerberosRequest();
        kerberosRequest.setMasterKey(kerberosMasterKey);
        kerberosRequest.setAdmin(kerberosAdmin);
        kerberosRequest.setPassword(kerberosPassword);
        ambariV2Request.setKerberos(kerberosRequest);
    }
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) StackV2Request(com.sequenceiq.cloudbreak.api.model.v2.StackV2Request) AmbariV2Request(com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) ClusterV2Request(com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request) GatewayJson(com.sequenceiq.cloudbreak.api.model.GatewayJson) Parameters(org.testng.annotations.Parameters) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

AmbariV2Request (com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request)3 ClusterV2Request (com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request)2 ClusterRequest (com.sequenceiq.cloudbreak.api.model.ClusterRequest)1 FileSystemRequest (com.sequenceiq.cloudbreak.api.model.FileSystemRequest)1 GatewayJson (com.sequenceiq.cloudbreak.api.model.GatewayJson)1 KerberosRequest (com.sequenceiq.cloudbreak.api.model.KerberosRequest)1 StackV2Request (com.sequenceiq.cloudbreak.api.model.v2.StackV2Request)1 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)1 BeforeMethod (org.testng.annotations.BeforeMethod)1 Parameters (org.testng.annotations.Parameters)1