本文整理了Java中com.microsoft.azure.management.Azure.networkInterfaces()
方法的一些代码示例,展示了Azure.networkInterfaces()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Azure.networkInterfaces()
方法的具体详情如下:
包路径:com.microsoft.azure.management.Azure
类名称:Azure
方法名:networkInterfaces
暂无
代码示例来源:origin: jenkinsci/azure-vm-agents-plugin
/**
* Remove the IP name.
*
* @param resourceGroupName
* @param vmName
* @throws AzureCloudException
*/
public void removeIPName(String resourceGroupName,
String vmName) throws AzureCloudException {
final String nic = vmName + "NIC";
try {
LOGGER.log(Level.INFO, "Remove NIC {0}", nic);
azureClient.networkInterfaces().deleteByResourceGroup(resourceGroupName, nic);
} catch (Exception e) {
LOGGER.log(Level.WARNING, "AzureVMManagementServiceDelegate: removeIPName: while deleting NIC", e);
}
final String ip = vmName + "IPName";
try {
LOGGER.log(Level.INFO, "Remove IP {0}", ip);
azureClient.publicIPAddresses().deleteByResourceGroup(resourceGroupName, ip);
} catch (Exception e) {
LOGGER.log(Level.WARNING, "AzureVMManagementServiceDelegate: removeIPName: while deleting IPName", e);
}
}
代码示例来源: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));
}
}
内容来源于网络,如有侵权,请联系作者删除!