您好我试图从Azure Java SDK获取资源组中的资源名称。但是找不到合适的方法。
ArrayList<ResourceGroupExtended> groups = resourceManagementClient.getResourceGroupsOperations().list(null).getResourceGroups();
for (GenericResourceExtended genericResourceExtended : resourceList) {
System.out.println( "genericResourceExtended Name :"+genericResourceExtended.getName());
}
如果你尝试过同样的话,请与我分享你的想法。感谢
答案 0 :(得分:2)
试试这个:
ArrayList<ResourceGroupExtended> groups = client.getResourceGroupsOperations().list(null).getResourceGroups();
for (ResourceGroupExtended group : groups) {
System.out.println(group.getName());
ResourceListParameters resListParams = new ResourceListParameters();
resListParams.setResourceGroupName(group.getName());
ArrayList<GenericResourceExtended> resList = client.getResourcesOperations().list(resListParams).getResources();
for(GenericResourceExtended r: resList) {
System.out.println("Resource Type: "+r.getType()+" name: "+r.getName());
}
}