Search in sources :

Example 1 with CustomConfigurations

use of com.sequenceiq.cloudbreak.domain.CustomConfigurations in project cloudbreak by hortonworks.

the class CustomConfigurationsService method cloneByName.

public CustomConfigurations cloneByName(String name, String newName, String newRuntimeVersion, String accountId) {
    CustomConfigurations customConfigurationsByName = getByName(name, accountId);
    CustomConfigurations newCustomConfigurations = cloneCustomConfigs(customConfigurationsByName, newName, newRuntimeVersion);
    return create(newCustomConfigurations, accountId);
}
Also used : CustomConfigurations(com.sequenceiq.cloudbreak.domain.CustomConfigurations)

Example 2 with CustomConfigurations

use of com.sequenceiq.cloudbreak.domain.CustomConfigurations in project cloudbreak by hortonworks.

the class CustomConfigurationsService method cloneCustomConfigs.

private CustomConfigurations cloneCustomConfigs(CustomConfigurations existingCustomConfigurations, String newName, String newRuntimeVersion) {
    CustomConfigurations clone = new CustomConfigurations(existingCustomConfigurations);
    Set<CustomConfigurationProperty> newConfigSet = existingCustomConfigurations.getConfigurations().stream().map(config -> new CustomConfigurationProperty(config.getName(), config.getValue(), config.getRoleType(), config.getServiceType())).collect(Collectors.toSet());
    clone.setConfigurations(newConfigSet);
    clone.setName(newName);
    clone.setRuntimeVersion(newRuntimeVersion);
    return clone;
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) CustomConfigurationsValidator(com.sequenceiq.cloudbreak.validation.CustomConfigurationsValidator) LoggerFactory(org.slf4j.LoggerFactory) OwnerAssignmentService(com.sequenceiq.authorization.service.OwnerAssignmentService) SecretService(com.sequenceiq.cloudbreak.service.secret.service.SecretService) CompositeAuthResourcePropertyProvider(com.sequenceiq.authorization.service.CompositeAuthResourcePropertyProvider) ClusterService(com.sequenceiq.cloudbreak.service.cluster.ClusterService) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Inject(javax.inject.Inject) CrnResourceDescriptor(com.sequenceiq.cloudbreak.auth.crn.CrnResourceDescriptor) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) Service(org.springframework.stereotype.Service) Map(java.util.Map) AuthorizationResourceType(com.sequenceiq.authorization.resource.AuthorizationResourceType) NotFoundException(com.sequenceiq.cloudbreak.common.exception.NotFoundException) EnumSet(java.util.EnumSet) CustomConfigurationsCreationException(com.sequenceiq.cloudbreak.exception.CustomConfigurationsCreationException) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Logger(org.slf4j.Logger) Collection(java.util.Collection) CustomConfigurationPropertyRepository(com.sequenceiq.cloudbreak.repository.CustomConfigurationPropertyRepository) RegionAwareCrnGenerator(com.sequenceiq.cloudbreak.auth.crn.RegionAwareCrnGenerator) CustomConfigurations(com.sequenceiq.cloudbreak.domain.CustomConfigurations) Set(java.util.Set) Crn(com.sequenceiq.cloudbreak.auth.crn.Crn) Collectors(java.util.stream.Collectors) NameOrCrn(com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn) List(java.util.List) MDCUtils(com.sequenceiq.cloudbreak.logger.MDCUtils) CustomConfigurationsRepository(com.sequenceiq.cloudbreak.repository.CustomConfigurationsRepository) Optional(java.util.Optional) CustomConfigurationProperty(com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty) CustomConfigurationProperty(com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty) CustomConfigurations(com.sequenceiq.cloudbreak.domain.CustomConfigurations)

Example 3 with CustomConfigurations

use of com.sequenceiq.cloudbreak.domain.CustomConfigurations in project cloudbreak by hortonworks.

the class CustomConfigurationsService method cloneByCrn.

public CustomConfigurations cloneByCrn(String crn, String newName, String newRuntimeVersion, String accountId) {
    CustomConfigurations customConfigurationsByCrn = getByCrn(crn);
    CustomConfigurations newCustomConfigurations = cloneCustomConfigs(customConfigurationsByCrn, newName, newRuntimeVersion);
    return create(newCustomConfigurations, accountId);
}
Also used : CustomConfigurations(com.sequenceiq.cloudbreak.domain.CustomConfigurations)

Example 4 with CustomConfigurations

use of com.sequenceiq.cloudbreak.domain.CustomConfigurations in project cloudbreak by hortonworks.

the class CustomConfigurationsService method deleteByCrn.

public CustomConfigurations deleteByCrn(String crn) {
    CustomConfigurations customConfigurationsByCrn = getByCrn(crn);
    prepareDeletion(customConfigurationsByCrn);
    customConfigurationPropertyRepository.deleteAll(customConfigurationsByCrn.getConfigurations());
    ownerAssignmentService.notifyResourceDeleted(crn, MDCUtils.getRequestId());
    return customConfigurationsByCrn;
}
Also used : CustomConfigurations(com.sequenceiq.cloudbreak.domain.CustomConfigurations)

Example 5 with CustomConfigurations

use of com.sequenceiq.cloudbreak.domain.CustomConfigurations in project cloudbreak by hortonworks.

the class CustomConfigurationsToCustomConfigurationsDetailsConverterTest method testConvertEmptyNoNPE.

@Test
void testConvertEmptyNoNPE() {
    CustomConfigurations customConfigurations = new CustomConfigurations();
    CustomConfigurationsDetails customConfigurationsDetails = underTest.convert(customConfigurations);
    assertThat(customConfigurationsDetails).isNotNull();
}
Also used : CustomConfigurations(com.sequenceiq.cloudbreak.domain.CustomConfigurations) CustomConfigurationsDetails(com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails) Test(org.junit.jupiter.api.Test)

Aggregations

CustomConfigurations (com.sequenceiq.cloudbreak.domain.CustomConfigurations)15 Test (org.junit.jupiter.api.Test)9 CustomConfigurationProperty (com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty)4 CustomConfigurationsDetails (com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails)3 CustomConfigurationPropertyParameters (com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters)2 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)2 Collection (java.util.Collection)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Sets (com.google.common.collect.Sets)1 AuthorizationResourceType (com.sequenceiq.authorization.resource.AuthorizationResourceType)1 CompositeAuthResourcePropertyProvider (com.sequenceiq.authorization.service.CompositeAuthResourcePropertyProvider)1 OwnerAssignmentService (com.sequenceiq.authorization.service.OwnerAssignmentService)1 NameOrCrn (com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn)1 CustomConfigurationsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.responses.CustomConfigurationsV4Response)1 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)1 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)1 CrnResourceDescriptor (com.sequenceiq.cloudbreak.auth.crn.CrnResourceDescriptor)1 RegionAwareCrnGenerator (com.sequenceiq.cloudbreak.auth.crn.RegionAwareCrnGenerator)1 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1