use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest in project cloudbreak by hortonworks.
the class StackToCreateFreeIpaRequestConverter method getInstanceGroupNetworkRequest.
private InstanceGroupNetworkRequest getInstanceGroupNetworkRequest(InstanceGroupNetwork instanceGroupNetwork) {
InstanceGroupNetworkRequest request = null;
if (instanceGroupNetwork != null) {
request = new InstanceGroupNetworkRequest();
List<String> subnetIds = instanceGroupNetwork.getAttributes().getValue(NetworkConstants.SUBNET_IDS);
if (subnetIds != null) {
LOGGER.debug("Subnet IDs found in instance group network");
InstanceGroupAwsNetworkParameters aws = new InstanceGroupAwsNetworkParameters();
aws.setSubnetIds(subnetIds);
request.setAws(aws);
}
}
LOGGER.debug("Created instance group network request {} from instance group network {}", request, instanceGroupNetwork);
return request;
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest in project cloudbreak by hortonworks.
the class InstanceGroupNetworkRequestToInstanceGroupNetworkConverter method convert.
public InstanceGroupNetwork convert(String cloudPlatform, @Nonnull InstanceGroupNetworkRequest source) {
InstanceGroupNetwork entity = new InstanceGroupNetwork();
entity.setCloudPlatform(cloudPlatform);
Map<String, Object> params = new HashMap<>();
InstanceGroupAwsNetworkParameters aws = source.getAws();
if (aws != null && aws.getSubnetIds() != null) {
List<String> subnetIds = aws.getSubnetIds();
params.put(NetworkConstants.SUBNET_IDS, subnetIds);
}
entity.setAttributes(new Json(params));
return entity;
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest in project cloudbreak by hortonworks.
the class FreeIpaAwsNetworkProvider method networkByGroup.
@Override
public InstanceGroupNetworkRequest networkByGroup(EnvironmentDto environment) {
InstanceGroupNetworkRequest instanceGroupNetworkRequest = new InstanceGroupNetworkRequest();
ProvidedSubnetIds providedSubnetIds = subnetIdProvider.subnets(environment.getNetwork(), environment.getExperimentalFeatures().getTunnel(), CloudPlatform.AWS, true);
InstanceGroupAwsNetworkParameters instanceGroupAwsNetworkParameters = new InstanceGroupAwsNetworkParameters();
instanceGroupAwsNetworkParameters.setSubnetIds(new ArrayList<>(providedSubnetIds.getSubnetIds()));
instanceGroupNetworkRequest.setAws(instanceGroupAwsNetworkParameters);
return instanceGroupNetworkRequest;
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest in project cloudbreak by hortonworks.
the class FreeIpaCreationHandler method createInstanceGroupRequests.
private List<InstanceGroupRequest> createInstanceGroupRequests(CreateFreeIpaRequest createFreeIpaRequest, SecurityGroupRequest securityGroupRequest, EnvironmentDto environment, boolean multiAzRequired) {
List<InstanceGroupRequest> instanceGroupRequests = new LinkedList<>();
FreeIpaCreationDto freeIpaCreation = environment.getFreeIpaCreation();
InstanceGroupRequest instanceGroupRequest = new InstanceGroupRequest();
instanceGroupRequest.setName(MASTER_GROUP_NAME);
instanceGroupRequest.setNodeCount(freeIpaCreation.getInstanceCountByGroup());
instanceGroupRequest.setType(InstanceGroupType.MASTER);
instanceGroupRequest.setSecurityGroup(securityGroupRequest);
instanceGroupRequest.setInstanceTemplateRequest(createInstanceTemplate(freeIpaCreation));
if (multiAzRequired && multiAzValidator.suportedMultiAzForEnvironment(environment.getCloudPlatform())) {
FreeIpaNetworkProvider freeIpaNetworkProvider = freeIpaNetworkProviderMapByCloudPlatform.get(CloudPlatform.valueOf(environment.getCloudPlatform()));
if (freeIpaNetworkProvider != null) {
InstanceGroupNetworkRequest instanceGroupNetworkRequest = freeIpaNetworkProvider.networkByGroup(environment);
instanceGroupRequest.setNetwork(instanceGroupNetworkRequest);
createFreeIpaRequest.getPlacement().setAvailabilityZone(freeIpaNetworkProvider.availabilityZone(instanceGroupNetworkRequest, environment));
}
}
instanceGroupRequests.add(instanceGroupRequest);
return instanceGroupRequests;
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest in project cloudbreak by hortonworks.
the class FreeIpaTestDto method mapInstanceGroupNetwork.
private InstanceGroupNetworkRequest mapInstanceGroupNetwork(InstanceGroupNetworkV4Request source) {
if (source != null) {
InstanceGroupNetworkRequest result = new InstanceGroupNetworkRequest();
if (source.getAws() != null) {
InstanceGroupAwsNetworkParameters aws = new InstanceGroupAwsNetworkParameters();
aws.setSubnetIds(source.getAws().getSubnetIds());
result.setAws(aws);
}
return result;
} else {
return null;
}
}
Aggregations