use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.AwsNetworkV4Parameters in project cloudbreak by hortonworks.
the class NetworkV4BaseTest method testIsEmptyShouldReturnFalseForEditedInstance.
@Test
void testIsEmptyShouldReturnFalseForEditedInstance() {
underTest.setAws(new AwsNetworkV4Parameters());
assertFalse(underTest.isEmpty());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.AwsNetworkV4Parameters in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4Converter method convertToAwsStackRequest.
private AwsNetworkV4Parameters convertToAwsStackRequest(Pair<AwsNetworkV1Parameters, EnvironmentNetworkResponse> source) {
EnvironmentNetworkResponse value = source.getValue();
AwsNetworkV1Parameters key = source.getKey();
AwsNetworkV4Parameters response = new AwsNetworkV4Parameters();
if (key != null) {
response.setVpcId(value.getAws().getVpcId());
String subnetId = key.getSubnetId();
if (!Strings.isNullOrEmpty(subnetId)) {
response.setSubnetId(key.getSubnetId());
} else if (value != null) {
response.setSubnetId(value.getPreferedSubnetId());
}
if (PublicEndpointAccessGateway.ENABLED.equals(value.getPublicEndpointAccessGateway())) {
ValidationResult validationResult = endpointGatewayNetworkValidator.validate(new ImmutablePair<>(response.getSubnetId(), value));
if (validationResult.getState() == ValidationResult.State.ERROR || validationResult.hasError()) {
throw new BadRequestException("Endpoint gateway subnet validation failed: " + validationResult.getFormattedErrors());
}
Optional<CloudSubnet> endpointGatewaySubnet = subnetSelector.chooseSubnetForEndpointGateway(value, response.getSubnetId());
if (endpointGatewaySubnet.isPresent()) {
response.setEndpointGatewaySubnetId(endpointGatewaySubnet.get().getId());
}
}
}
return response;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.AwsNetworkV4Parameters in project cloudbreak by hortonworks.
the class DistroXV1RequestToStackV4RequestConverterTest method createAwsNetworkV4Parameters.
private AwsNetworkV4Parameters createAwsNetworkV4Parameters() {
AwsNetworkV4Parameters awsNetwork = new AwsNetworkV4Parameters();
awsNetwork.setSubnetId("mysubnetid");
awsNetwork.setVpcId("myvpc");
return awsNetwork;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.AwsNetworkV4Parameters in project cloudbreak by hortonworks.
the class TestUtil method awsNetworkV4Parameters.
public static AwsNetworkV4Parameters awsNetworkV4Parameters() {
AwsNetworkV4Parameters p = new AwsNetworkV4Parameters();
p.setSubnetId("someAwsSubnet");
p.setVpcId("someAwsVpc");
p.setInternetGatewayId("someAwsInternetGatewayId");
return p;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.network.AwsNetworkV4Parameters in project cloudbreak by hortonworks.
the class TestUtil method networkV4RequestForAws.
public static NetworkV4Request networkV4RequestForAws() {
NetworkV4Request r = new NetworkV4Request();
r.setAws(awsNetworkV4Parameters());
r.setCloudPlatform(CloudPlatform.AWS);
r.setSubnetCIDR("0.0.0.0/0");
return r;
}
Aggregations