use of me.snowdrop.istio.api.networking.v1alpha3.HTTPRouteDestinationBuilder in project kubernetes by ballerinax.
the class IstioVirtualServiceHandler method populateRouteList.
/**
* Parse an route list to a yaml map.
*
* @param serviceName The name of the service.
* @param routeModels The list of destination weights
* @return A list of yaml maps.
*/
private List<HTTPRouteDestination> populateRouteList(String serviceName, List<IstioDestinationWeight> routeModels) {
if (routeModels == null) {
routeModels = new LinkedList<>();
}
if (routeModels.size() == 0) {
routeModels.add(new IstioDestinationWeight());
}
List<HTTPRouteDestination> destinationWeightList = new LinkedList<>();
for (IstioDestinationWeight destinationWeightModel : routeModels) {
HTTPRouteDestination routeDestination = new HTTPRouteDestinationBuilder().withWeight(destinationWeightModel.getWeight()).withDestination(populateDestination(serviceName, destinationWeightModel.getDestination())).build();
destinationWeightList.add(routeDestination);
}
return destinationWeightList;
}
Aggregations