com.microsoft.azure.management.Azure.networks()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(194)

本文整理了Java中com.microsoft.azure.management.Azure.networks()方法的一些代码示例,展示了Azure.networks()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Azure.networks()方法的具体详情如下:
包路径:com.microsoft.azure.management.Azure
类名称:Azure
方法名:networks

Azure.networks介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/azure-vm-agents-plugin

/**
 * Returns virtual network site properties.
 *
 * @param virtualNetworkName
 * @param resourceGroupName
 * @return
 */
public Network getVirtualNetwork(String virtualNetworkName, String resourceGroupName) {
  try {
    return azureClient.networks().getByResourceGroup(resourceGroupName, virtualNetworkName);
  } catch (Exception e) {
    LOGGER.log(Level.SEVERE, "AzureVMManagementServiceDelegate: getVirtualNetworkInfo: "
        + "Got exception while getting virtual network info: ", e);
  }
  return null;
}

代码示例来源:origin: Microsoft/azure-tools-for-java

public static Map<String, Pair<String, List<String>>> getVirtualNetworks(Azure azureClient, String region) {
 Map<String, Pair<String, List<String>>> result = new HashMap<>();
 if (azureClient != null) {
  for (Network vnet : azureClient.networks().list()) {
   if (vnet.regionName().toLowerCase().equals(region) || vnet.regionName().toLowerCase().equals(region)) {
    List<String> subnets = new ArrayList<>();
    subnets.addAll(vnet.subnets().keySet());
    result.put(vnet.id(), new Pair<>(vnet.name(), subnets));
   }
  }
 }
 return result;
}

代码示例来源:origin: Microsoft/azure-tools-for-java

public static List<AzureDockerVnet> getVirtualNetworks(Azure azureClient) {
 List<AzureDockerVnet> result = new ArrayList<>();
 if (azureClient != null) {
  for (Network net : azureClient.networks().list()) {
   AzureDockerVnet vnet = new AzureDockerVnet();
   vnet.name = net.name();
   vnet.addrSpace = net.addressSpaces().get(0);
   vnet.id = net.id();
   vnet.region = net.regionName().toLowerCase();
   vnet.resourceGroup = net.resourceGroupName();
   vnet.subnets = new ArrayList<>();
   for (Subnet subnet : net.subnets().values()) {
    vnet.subnets.add(subnet.name());
   }
   result.add(vnet);
  }
 }
 return result;
}

代码示例来源:origin: Microsoft/azure-tools-for-java

vnet = azureClient.networks().getByResourceGroup(vnetResourceGroupName, vnetName);
} else {
 vnet = azureClient.networks()
   .define(newHost.hostVM.vnetName)
   .withRegion(newHost.hostVM.region)

代码示例来源:origin: Microsoft/azure-tools-for-java

public static void deleteDockerHostAll(Azure azureClient, String resourceGroup, String vmName) {
 if (azureClient == null || resourceGroup == null || vmName == null ) {
  throw new AzureDockerException("Unexpected param values; Azure instance, resource group and VM name cannot be null");
 }
 VirtualMachine vm = azureClient.virtualMachines().getByResourceGroup(resourceGroup, vmName);
 if (vm == null) {
  throw new AzureDockerException(String.format("Unexpected error retrieving VM %s from Azure", vmName));
 }
 try {
  PublicIPAddress publicIp = vm.getPrimaryPublicIPAddress();
  NicIPConfiguration nicIPConfiguration = publicIp.getAssignedNetworkInterfaceIPConfiguration();
  Network vnet = nicIPConfiguration.getNetwork();
  NetworkInterface nic = vm.getPrimaryNetworkInterface();
  azureClient.virtualMachines().deleteById(vm.id());
  azureClient.networkInterfaces().deleteById(nic.id());
  azureClient.publicIPAddresses().deleteById(publicIp.id());
  azureClient.networks().deleteById(vnet.id());
 } catch (Exception e) {
  throw new AzureDockerException(String.format("Unexpected error while deleting VM %s and its associated resources", vmName));
 }
}

代码示例来源:origin: Microsoft/azure-tools-for-java

Network.DefinitionStages.WithGroup networkWithGroup = azure.networks().define(newNetwork.name).withRegion(region);
Creatable<Network> newVirtualNetwork;
if (withNewResourceGroup) {

相关文章