Search in sources :

Example 1 with StackToExternalDatabaseRequestConverter

use of com.sequenceiq.cloudbreak.converter.v4.stacks.StackToExternalDatabaseRequestConverter in project cloudbreak by hortonworks.

the class StackToStackV4RequestConverter method convert.

public StackV4Request convert(Stack source) {
    StackV4Request stackV4Request = new StackV4Request();
    stackV4Request.setCloudPlatform(getIfNotNull(source.getCloudPlatform(), cp -> Enum.valueOf(CloudPlatform.class, cp)));
    stackV4Request.setEnvironmentCrn(source.getEnvironmentCrn());
    stackV4Request.setCustomDomain(getCustomDomainSettings(source));
    providerParameterCalculator.parse(new HashMap<>(source.getParameters()), stackV4Request);
    stackV4Request.setAuthentication(stackAuthenticationToStackAuthenticationV4RequestConverter.convert(source.getStackAuthentication()));
    stackV4Request.setNetwork(networkToNetworkV4RequestConverter.convert(source.getNetwork()));
    stackV4Request.setCluster(clusterToClusterV4RequestConverter.convert(source.getCluster()));
    stackV4Request.setExternalDatabase(getIfNotNull(source, stackToExternalDatabaseRequestConverter::convert));
    if (!source.getLoadBalancers().isEmpty()) {
        stackV4Request.setEnableLoadBalancer(true);
    }
    stackV4Request.setInstanceGroups(getInstanceGroups(source));
    prepareImage(source, stackV4Request);
    prepareTags(source, stackV4Request);
    prepareTelemetryRequest(source, stackV4Request);
    datalakeService.prepareDatalakeRequest(source, stackV4Request);
    stackV4Request.setPlacement(getPlacementSettings(source.getRegion(), source.getAvailabilityZone()));
    prepareInputs(source, stackV4Request);
    stackV4Request.setTimeToLive(getStackTimeToLive(source));
    return stackV4Request;
}
Also used : PlacementSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.environment.placement.PlacementSettingsV4Request) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) NullUtil.getIfNotNull(com.sequenceiq.cloudbreak.util.NullUtil.getIfNotNull) TelemetryConverter(com.sequenceiq.cloudbreak.converter.v4.stacks.TelemetryConverter) LoggerFactory(org.slf4j.LoggerFactory) DatalakeService(com.sequenceiq.cloudbreak.service.sharedservice.DatalakeService) HashMap(java.util.HashMap) ComponentConfigProviderService(com.sequenceiq.cloudbreak.service.ComponentConfigProviderService) PlatformParametersConsts(com.sequenceiq.cloudbreak.cloud.PlatformParametersConsts) Image(com.sequenceiq.cloudbreak.cloud.model.Image) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) ArrayList(java.util.ArrayList) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) Inject(javax.inject.Inject) Strings(com.google.common.base.Strings) ProviderParameterCalculator(com.sequenceiq.cloudbreak.common.mappable.ProviderParameterCalculator) Map(java.util.Map) CustomDomainSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) InstanceGroupV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request) StackToExternalDatabaseRequestConverter(com.sequenceiq.cloudbreak.converter.v4.stacks.StackToExternalDatabaseRequestConverter) TagsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.tags.TagsV4Request) Logger(org.slf4j.Logger) ImageSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.image.ImageSettingsV4Request) StackTags(com.sequenceiq.cloudbreak.cloud.model.StackTags) Set(java.util.Set) IOException(java.io.IOException) StackInputs(com.sequenceiq.cloudbreak.cloud.model.StackInputs) Collectors(java.util.stream.Collectors) CloudbreakImageNotFoundException(com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException) Recipe(com.sequenceiq.cloudbreak.domain.Recipe) List(java.util.List) Component(org.springframework.stereotype.Component) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) Optional(java.util.Optional) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) InstanceGroupNetworkToInstanceGroupNetworkV4RequestConverter(com.sequenceiq.cloudbreak.converter.v4.stacks.instancegroup.network.InstanceGroupNetworkToInstanceGroupNetworkV4RequestConverter) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)

Aggregations

Strings (com.google.common.base.Strings)1 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)1 CustomDomainSettingsV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request)1 PlacementSettingsV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.environment.placement.PlacementSettingsV4Request)1 ImageSettingsV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.image.ImageSettingsV4Request)1 InstanceGroupV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request)1 TagsV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.tags.TagsV4Request)1 PlatformParametersConsts (com.sequenceiq.cloudbreak.cloud.PlatformParametersConsts)1 Image (com.sequenceiq.cloudbreak.cloud.model.Image)1 StackInputs (com.sequenceiq.cloudbreak.cloud.model.StackInputs)1 StackTags (com.sequenceiq.cloudbreak.cloud.model.StackTags)1 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)1 ProviderParameterCalculator (com.sequenceiq.cloudbreak.common.mappable.ProviderParameterCalculator)1 StackToExternalDatabaseRequestConverter (com.sequenceiq.cloudbreak.converter.v4.stacks.StackToExternalDatabaseRequestConverter)1 TelemetryConverter (com.sequenceiq.cloudbreak.converter.v4.stacks.TelemetryConverter)1 InstanceGroupNetworkToInstanceGroupNetworkV4RequestConverter (com.sequenceiq.cloudbreak.converter.v4.stacks.instancegroup.network.InstanceGroupNetworkToInstanceGroupNetworkV4RequestConverter)1 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)1 Recipe (com.sequenceiq.cloudbreak.domain.Recipe)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1