Skip to content

Commit

Permalink
CB-22419 Unable to register GCP environment on the UI. We need to nul…
Browse files Browse the repository at this point in the history
…l check for the response [Google is stange..]
  • Loading branch information
doktoric authored and lacikaaa committed Jul 6, 2023
1 parent 17e0084 commit ca89276
Showing 1 changed file with 27 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,34 +201,36 @@ public CloudNetworks networks(ExtendedCloudCredential cloudCredential, Region re
.orElse(null);
LOGGER.debug("Zone chosen for the subnets is {}", zone);

for (Network network : networkList.getItems()) {
Map<String, Object> properties = new HashMap<>();
properties.put("gatewayIPv4", Strings.nullToEmpty(network.getGatewayIPv4()));
properties.put("description", Strings.nullToEmpty(network.getDescription()));
properties.put("IPv4Range", Strings.nullToEmpty(network.getIPv4Range()));
properties.put("creationTimestamp", Strings.nullToEmpty(network.getCreationTimestamp()));

Set<CloudSubnet> subnets = new HashSet<>();
if (subnetworkList != null && network.getSubnetworks() != null && subnetworkList.getItems() != null) {
for (Subnetwork subnetwork : subnetworkList.getItems()) {
if (network.getSubnetworks().contains(subnetwork.getSelfLink())) {
boolean igwAvailable = !Strings.isNullOrEmpty(subnetwork.getGatewayAddress());
subnets.add(
new CloudSubnet(
subnetwork.getId().toString(),
subnetwork.getName(),
zone,
subnetwork.getIpCidrRange(),
subnetwork.getPrivateIpGoogleAccess(),
!subnetwork.getPrivateIpGoogleAccess(),
igwAvailable,
igwAvailable ? PUBLIC : PRIVATE));
if (networkList != null) {
for (Network network : networkList.getItems()) {
Map<String, Object> properties = new HashMap<>();
properties.put("gatewayIPv4", Strings.nullToEmpty(network.getGatewayIPv4()));
properties.put("description", Strings.nullToEmpty(network.getDescription()));
properties.put("IPv4Range", Strings.nullToEmpty(network.getIPv4Range()));
properties.put("creationTimestamp", Strings.nullToEmpty(network.getCreationTimestamp()));

Set<CloudSubnet> subnets = new HashSet<>();
if (subnetworkList != null && network.getSubnetworks() != null && subnetworkList.getItems() != null) {
for (Subnetwork subnetwork : subnetworkList.getItems()) {
if (network.getSubnetworks().contains(subnetwork.getSelfLink())) {
boolean igwAvailable = !Strings.isNullOrEmpty(subnetwork.getGatewayAddress());
subnets.add(
new CloudSubnet(
subnetwork.getId().toString(),
subnetwork.getName(),
zone,
subnetwork.getIpCidrRange(),
subnetwork.getPrivateIpGoogleAccess(),
!subnetwork.getPrivateIpGoogleAccess(),
igwAvailable,
igwAvailable ? PUBLIC : PRIVATE));
}
}
}
}

CloudNetwork cloudNetwork = new CloudNetwork(network.getName(), network.getId().toString(), subnets, properties);
cloudNetworks.add(cloudNetwork);
CloudNetwork cloudNetwork = new CloudNetwork(network.getName(), network.getId().toString(), subnets, properties);
cloudNetworks.add(cloudNetwork);
}
}
result.put(region.value(), cloudNetworks);

Expand Down

0 comments on commit ca89276

Please sign in to comment.