use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.
the class OpenStackCredentialConnector method verify.
@Override
public CloudCredentialStatus verify(AuthenticatedContext authenticatedContext) {
CloudCredential credential = authenticatedContext.getCloudCredential();
String smartSenseId = smartSenseIdGenerator.getSmartSenseId();
if (StringUtils.isNoneEmpty(smartSenseId)) {
credential.putParameter(SMART_SENSE_ID, smartSenseId);
}
return new CloudCredentialStatus(credential, CredentialStatus.VERIFIED);
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.
the class AbstractStackUpscaleAction method createFlowContext.
@Override
protected StackScalingFlowContext createFlowContext(String flowId, StateContext<StackUpscaleState, StackUpscaleEvent> stateContext, P payload) {
Map<Object, Object> variables = stateContext.getExtendedState().getVariables();
Stack stack = stackService.getByIdWithLists(payload.getStackId());
MDCBuilder.buildMdcContext(stack);
Location location = location(region(stack.getRegion()), availabilityZone(stack.getAvailabilityZone()));
CloudContext cloudContext = new CloudContext(stack.getId(), stack.getName(), stack.cloudPlatform(), stack.getOwner(), stack.getPlatformVariant(), location);
CloudCredential cloudCredential = credentialConverter.convert(stack.getCredential());
CloudStack cloudStack = cloudStackConverter.convert(stack);
return new StackScalingFlowContext(flowId, stack, cloudContext, cloudCredential, cloudStack, getInstanceGroupName(variables), Collections.emptySet(), getAdjustment(variables), getHostNames(variables));
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.
the class ClusterCreationSetupService method validate.
public void validate(ClusterRequest request, CloudCredential cloudCredential, Stack stack, IdentityUser user) {
if (request.getEnableSecurity() && request.getKerberos() == null) {
throw new BadRequestException("If the security is enabled the kerberos parameters cannot be empty");
}
MDCBuilder.buildUserMdcContext(user);
CloudCredential credential = cloudCredential;
if (credential == null) {
credential = credentialToCloudCredentialConverter.convert(stack.getCredential());
}
fileSystemValidator.validateFileSystem(stack.cloudPlatform(), credential, request.getFileSystem());
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.
the class ParameterGenerator method createCloudCredential.
public CloudCredential createCloudCredential() {
CloudCredential c = new CloudCredential(1L, "opencred");
c.putParameter("userName", "userName");
c.putParameter("password", "password");
c.putParameter("tenantName", "tenantName");
c.putParameter("endpoint", "http://endpoint:8080/v2.0");
return c;
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudCredential in project cloudbreak by hortonworks.
the class ServiceProviderSetupAdapter method checkImage.
public ImageStatusResult checkImage(Stack stack) throws Exception {
Location location = location(region(stack.getRegion()), availabilityZone(stack.getAvailabilityZone()));
CloudContext cloudContext = new CloudContext(stack.getId(), stack.getName(), stack.cloudPlatform(), stack.getOwner(), stack.getPlatformVariant(), location);
CloudCredential cloudCredential = credentialConverter.convert(stack.getCredential());
Image image = imageService.getImage(stack.getId());
CheckImageRequest<CheckImageResult> checkImageRequest = new CheckImageRequest<>(cloudContext, cloudCredential, cloudStackConverter.convert(stack), image);
LOGGER.info("Triggering event: {}", checkImageRequest);
eventBus.notify(checkImageRequest.selector(), eventFactory.createEvent(checkImageRequest));
try {
CheckImageResult res = checkImageRequest.await();
LOGGER.info("Result: {}", res);
if (res.getErrorDetails() != null) {
LOGGER.error("Failed to check image state", res.getErrorDetails());
throw new OperationException(res.getErrorDetails());
}
return new ImageStatusResult(res.getImageStatus(), res.getStatusProgressValue());
} catch (InterruptedException e) {
LOGGER.error("Error while executing check image", e);
throw new OperationException(e);
}
}
Aggregations