Search in sources :

Example 11 with CloudCredential

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);
}
Also used : ExtendedCloudCredential(com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) CloudCredentialStatus(com.sequenceiq.cloudbreak.cloud.model.CloudCredentialStatus)

Example 12 with CloudCredential

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));
}
Also used : CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) StackScalingFlowContext(com.sequenceiq.cloudbreak.core.flow2.stack.downscale.StackScalingFlowContext) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Stack(com.sequenceiq.cloudbreak.domain.Stack) Location(com.sequenceiq.cloudbreak.cloud.model.Location)

Example 13 with CloudCredential

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());
}
Also used : CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential)

Example 14 with CloudCredential

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;
}
Also used : CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential)

Example 15 with CloudCredential

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);
    }
}
Also used : CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) CheckImageResult(com.sequenceiq.cloudbreak.cloud.event.setup.CheckImageResult) Image(com.sequenceiq.cloudbreak.cloud.model.Image) OperationException(com.sequenceiq.cloudbreak.service.stack.connector.OperationException) Location(com.sequenceiq.cloudbreak.cloud.model.Location) CheckImageRequest(com.sequenceiq.cloudbreak.cloud.event.setup.CheckImageRequest) ImageStatusResult(com.sequenceiq.cloudbreak.common.type.ImageStatusResult)

Aggregations

CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)47 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)27 Location (com.sequenceiq.cloudbreak.cloud.model.Location)18 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)10 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)9 OperationException (com.sequenceiq.cloudbreak.service.stack.connector.OperationException)9 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)8 Stack (com.sequenceiq.cloudbreak.domain.Stack)8 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)7 CloudAccessConfigs (com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs)7 HashSet (java.util.HashSet)7 Compute (com.google.api.services.compute.Compute)6 CloudResource (com.sequenceiq.cloudbreak.cloud.model.CloudResource)6 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)6 AwsCredentialView (com.sequenceiq.cloudbreak.cloud.aws.view.AwsCredentialView)5 CloudRegions (com.sequenceiq.cloudbreak.cloud.model.CloudRegions)5 AvailabilityZone (com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone)4 CloudVmTypes (com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes)4 Strings (com.google.common.base.Strings)3