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;
}
Aggregations