use of com.microsoft.azure.management.network.Route in project azure-sdk-for-java by Azure.
the class TestRouteTables method printRouteTable.
/**
* Outputs info about a route table
* @param resource a route table
*/
public static void printRouteTable(RouteTable resource) {
StringBuilder info = new StringBuilder();
info.append("Route table: ").append(resource.id()).append("\n\tName: ").append(resource.name()).append("\n\tResource group: ").append(resource.resourceGroupName()).append("\n\tRegion: ").append(resource.region()).append("\n\tTags: ").append(resource.tags());
// Output routes
Map<String, Route> routes = resource.routes();
info.append("\n\tRoutes: ").append(routes.values().size());
for (Route route : routes.values()) {
info.append("\n\t\tName: ").append(route.name()).append("\n\t\t\tDestination address prefix: ").append(route.destinationAddressPrefix()).append("\n\t\t\tNext hop type: ").append(route.nextHopType().toString()).append("\n\t\t\tNext hop IP address: ").append(route.nextHopIPAddress());
}
// Output associated subnets
List<Subnet> subnets = resource.listAssociatedSubnets();
info.append("\n\tAssociated subnets: ").append(subnets.size());
for (Subnet subnet : subnets) {
info.append("\n\t\tResource group: ").append(subnet.parent().resourceGroupName()).append("\n\t\tNetwork name: ").append(subnet.parent().name()).append("\n\t\tSubnet name: ").append(subnet.name()).append("\n\tSubnet's route table ID: ").append(subnet.routeTableId());
}
System.out.println(info.toString());
}