use of com.vmware.photon.controller.model.resources.SubnetService.SubnetState in project photon-model by vmware.
the class AzureNetworkEnumerationAdapterService method buildSubnetState.
/**
* Map Azure subnet to {@link SubnetState}.
*/
private SubnetState buildSubnetState(Subnet subnet, List<String> tenantLinks, String endpointLink, String location, String parentLink) {
if (subnet == null) {
throw new IllegalArgumentException("Cannot map Subnet to subnet state for null " + "instance.");
}
SubnetState subnetState = new SubnetState();
subnetState.id = subnet.id;
subnetState.name = subnet.name;
if (subnet.properties != null) {
subnetState.subnetCIDR = subnet.properties.addressPrefix;
}
subnetState.tenantLinks = tenantLinks;
subnetState.endpointLink = endpointLink;
AdapterUtils.addToEndpointLinks(subnetState, endpointLink);
subnetState.supportPublicIpAddress = true;
subnetState.computeHostLink = parentLink;
subnetState.customProperties = new HashMap<>();
subnetState.regionId = location;
// on Azure, zoneId is the same as regionId
subnetState.zoneId = location;
if (AzureConstants.GATEWAY_SUBNET_NAME.equalsIgnoreCase(subnet.name)) {
// This is a subnet gateway. Mark it for infrastructure use only.
subnetState.customProperties.put(ComputeProperties.INFRASTRUCTURE_USE_PROP_NAME, Boolean.TRUE.toString());
}
return subnetState;
}
Aggregations