use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request in project cloudbreak by hortonworks.
the class StackToStackV4RequestConverter method getCustomDomainSettings.
private CustomDomainSettingsV4Request getCustomDomainSettings(Stack stack) {
CustomDomainSettingsV4Request cd = new CustomDomainSettingsV4Request();
cd.setDomainName(stack.getCustomDomain());
cd.setHostname(stack.getCustomHostname());
cd.setHostgroupNameAsHostname(stack.isHostgroupNameAsHostname());
cd.setClusterNameAsSubdomain(stack.isClusterNameAsSubdomain());
return cd;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request in project cloudbreak by hortonworks.
the class StackTestDtoBase method withDomainName.
public StackTestDtoBase<T> withDomainName(String domainName) {
CustomDomainSettingsV4Request request = Optional.ofNullable(getRequest().getCustomDomain()).orElse(new CustomDomainSettingsV4Request());
request.setDomainName(domainName);
getRequest().setCustomDomain(request);
return this;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request in project cloudbreak by hortonworks.
the class SdxService method resizeSdx.
public Pair<SdxCluster, FlowIdentifier> resizeSdx(final String userCrn, final String clusterName, final SdxClusterResizeRequest sdxClusterResizeRequest) {
LOGGER.info("Re-sizing SDX cluster with name {}", clusterName);
String accountIdFromCrn = getAccountIdFromCrn(userCrn);
String environmentName = sdxClusterResizeRequest.getEnvironment();
SdxClusterShape shape = sdxClusterResizeRequest.getClusterShape();
final SdxCluster sdxCluster = sdxClusterRepository.findByAccountIdAndClusterNameAndDeletedIsNullAndDetachedIsFalse(accountIdFromCrn, clusterName).orElseThrow(() -> notFound("SDX cluster", clusterName).get());
MDCBuilder.buildMdcContext(sdxCluster);
validateSdxResizeRequest(sdxCluster, accountIdFromCrn, shape);
StackV4Response stackV4Response = getDetail(clusterName, Set.of(StackResponseEntries.HARDWARE_INFO.getEntryName(), StackResponseEntries.EVENTS.getEntryName()), accountIdFromCrn);
DetailedEnvironmentResponse environment = validateAndGetEnvironment(environmentName);
SdxCluster newSdxCluster = validateAndCreateNewSdxCluster(userCrn, clusterName, sdxCluster.getRuntime(), shape, sdxCluster.isRangerRazEnabled(), sdxCluster.isEnableMultiAz(), environment);
newSdxCluster.setTags(sdxCluster.getTags());
newSdxCluster.setCrn(sdxCluster.getCrn());
CloudPlatform cloudPlatform = CloudPlatform.valueOf(environment.getCloudPlatform());
if (!StringUtils.isBlank(sdxCluster.getCloudStorageBaseLocation())) {
newSdxCluster.setCloudStorageBaseLocation(sdxCluster.getCloudStorageBaseLocation());
newSdxCluster.setCloudStorageFileSystemType(sdxCluster.getCloudStorageFileSystemType());
} else if (!CloudPlatform.YARN.equalsIgnoreCase(cloudPlatform.name()) && !CloudPlatform.GCP.equalsIgnoreCase(cloudPlatform.name()) && !CloudPlatform.MOCK.equalsIgnoreCase(cloudPlatform.name())) {
throw new BadRequestException("Cloud storage parameter is required.");
}
newSdxCluster.setDatabaseAvailabilityType(sdxCluster.getDatabaseAvailabilityType());
newSdxCluster.setDatabaseEngineVersion(sdxCluster.getDatabaseEngineVersion());
StackV4Request stackRequest = getStackRequest(shape, sdxCluster.isRangerRazEnabled(), null, cloudPlatform, sdxCluster.getRuntime(), null);
if (shape == SdxClusterShape.MEDIUM_DUTY_HA) {
// This is added to make sure the host name used by Light and Medium duty are not the same.
CustomDomainSettingsV4Request customDomainSettingsV4Request = new CustomDomainSettingsV4Request();
customDomainSettingsV4Request.setHostname(sdxCluster.getClusterName() + SDX_RESIZE_NAME_SUFFIX);
stackRequest.setCustomDomain(customDomainSettingsV4Request);
}
prepareCloudStorageForStack(stackRequest, stackV4Response, newSdxCluster, environment);
prepareDefaultSecurityConfigs(null, stackRequest, cloudPlatform);
try {
if (!StringUtils.isBlank(sdxCluster.getStackRequestToCloudbreak())) {
StackV4Request stackV4RequestOrig = JsonUtil.readValue(sdxCluster.getStackRequestToCloudbreak(), StackV4Request.class);
stackRequest.setImage(stackV4RequestOrig.getImage());
}
} catch (IOException ioException) {
LOGGER.error("Failed to re-use the image catalog. Will use default catalog", ioException);
}
stackRequest.setResourceCrn(newSdxCluster.getCrn());
newSdxCluster.setStackRequest(stackRequest);
FlowIdentifier flowIdentifier = sdxReactorFlowManager.triggerSdxResize(sdxCluster.getId(), newSdxCluster);
return Pair.of(sdxCluster, flowIdentifier);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request in project cloudbreak by hortonworks.
the class StackTestDtoBase method withHostgroupNameAsHostname.
public StackTestDtoBase<T> withHostgroupNameAsHostname(Boolean hostgroupNameAsHostname) {
CustomDomainSettingsV4Request request = Optional.ofNullable(getRequest().getCustomDomain()).orElse(new CustomDomainSettingsV4Request());
request.setHostgroupNameAsHostname(hostgroupNameAsHostname);
getRequest().setCustomDomain(request);
return this;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request in project cloudbreak by hortonworks.
the class StackTestDtoBase method withClusterNameAsSubdomain.
public StackTestDtoBase<T> withClusterNameAsSubdomain(Boolean clusterNameAsSubdomain) {
CustomDomainSettingsV4Request request = Optional.ofNullable(getRequest().getCustomDomain()).orElse(new CustomDomainSettingsV4Request());
request.setClusterNameAsSubdomain(clusterNameAsSubdomain);
getRequest().setCustomDomain(request);
return this;
}
Aggregations