Search in sources :

Example 1 with CredentialSourceRequest

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

the class StackRequestToStackValidationRequestConverter method convert.

@Override
public StackValidationRequest convert(StackRequest source) {
    ClusterRequest clusterRequest = source.getClusterRequest();
    StackValidationRequest stackValidationRequest = new StackValidationRequest();
    stackValidationRequest.setBlueprint(clusterRequest.getBlueprint());
    stackValidationRequest.setBlueprintId(clusterRequest.getBlueprintId());
    stackValidationRequest.setCredential(source.getCredential());
    stackValidationRequest.setCredentialId(source.getCredentialId());
    stackValidationRequest.setNetwork(source.getNetwork());
    stackValidationRequest.setNetworkId(source.getNetworkId());
    stackValidationRequest.setPlatform(source.getCloudPlatform());
    CredentialSourceRequest credentialSource = source.getCredentialSource();
    if (credentialSource != null) {
        if (!Strings.isNullOrEmpty(credentialSource.getSourceName())) {
            stackValidationRequest.setCredentialName(credentialSource.getSourceName());
        } else if (credentialSource.getSourceId() != null) {
            stackValidationRequest.setCredentialId(credentialSource.getSourceId());
        }
    }
    if (!Strings.isNullOrEmpty(source.getCredentialName())) {
        stackValidationRequest.setCredentialName(source.getCredentialName());
    }
    stackValidationRequest.setAccount(source.getAccount());
    stackValidationRequest.setBlueprintName(clusterRequest.getBlueprintName());
    stackValidationRequest.setFileSystem(source.getClusterRequest().getFileSystem());
    stackValidationRequest.setHostGroups(source.getClusterRequest().getHostGroups());
    stackValidationRequest.setInstanceGroups(new HashSet<>(source.getInstanceGroups()));
    return stackValidationRequest;
}
Also used : StackValidationRequest(com.sequenceiq.cloudbreak.api.model.StackValidationRequest) ClusterRequest(com.sequenceiq.cloudbreak.api.model.ClusterRequest) CredentialSourceRequest(com.sequenceiq.cloudbreak.api.model.CredentialSourceRequest)

Aggregations

ClusterRequest (com.sequenceiq.cloudbreak.api.model.ClusterRequest)1 CredentialSourceRequest (com.sequenceiq.cloudbreak.api.model.CredentialSourceRequest)1 StackValidationRequest (com.sequenceiq.cloudbreak.api.model.StackValidationRequest)1