本文整理汇总了Java中com.microsoft.azure.management.compute.VirtualMachineSize类的典型用法代码示例。如果您正苦于以下问题:Java VirtualMachineSize类的具体用法?Java VirtualMachineSize怎么用?Java VirtualMachineSize使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VirtualMachineSize类属于com.microsoft.azure.management.compute包,在下文中一共展示了VirtualMachineSize类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createResource
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exception {
List<VirtualMachineSize> availableSizes = virtualMachines.sizes().listByRegion(Region.US_EAST);
Assert.assertTrue(availableSizes.size() > 0);
System.out.println("VM Sizes: " + availableSizes);
final String vmName = "vm" + this.testId;
VirtualMachine vm = virtualMachines.define(vmName)
.withRegion(Region.US_EAST)
.withNewResourceGroup()
.withNewPrimaryNetwork("10.0.0.0/28")
.withPrimaryPrivateIPAddressDynamic()
.withoutPrimaryPublicIPAddress()
.withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
.withAdminUsername("testuser")
.withAdminPassword("12NewPA$$w0rd!")
.withSize(availableSizes.get(0).name()) // Use the first size
.create();
Assert.assertTrue(vm.size().toString().equalsIgnoreCase(availableSizes.get(0).name()));
return vm;
}
示例2: updateResource
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public VirtualMachine updateResource(VirtualMachine virtualMachine) throws Exception {
List<VirtualMachineSize> resizableSizes = virtualMachine.availableSizes();
Assert.assertTrue(resizableSizes.size() > 1);
VirtualMachineSize newSize = null;
for (VirtualMachineSize resizableSize : resizableSizes) {
if (!resizableSize.name().equalsIgnoreCase(virtualMachine.size().toString())) {
newSize = resizableSize;
break;
}
}
Assert.assertNotNull(newSize);
virtualMachine = virtualMachine.update()
.withSize(newSize.name())
.apply();
Assert.assertTrue(virtualMachine.size().toString().equalsIgnoreCase(newSize.name()));
return virtualMachine;
}
示例3: createResource
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public AvailabilitySet createResource(AvailabilitySets availabilitySets) throws Exception {
final String newName = "as" + this.testId;
AvailabilitySet aset = availabilitySets.define(newName)
.withRegion(Region.US_EAST)
.withNewResourceGroup()
.withFaultDomainCount(2)
.withUpdateDomainCount(4)
.withTag("tag1", "value1")
.create();
PagedList<VirtualMachineSize> vmSizes = aset.listVirtualMachineSizes();
Assert.assertTrue(vmSizes.size() > 0);
for (VirtualMachineSize vmSize : vmSizes) {
Assert.assertNotNull(vmSize.name());
}
return aset;
}
示例4: VirtualMachineImpl
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
VirtualMachineImpl(String name,
VirtualMachineInner innerModel,
final ComputeManager computeManager,
final StorageManager storageManager,
final NetworkManager networkManager,
final GraphRbacManager rbacManager) {
super(name, innerModel, computeManager);
this.storageManager = storageManager;
this.networkManager = networkManager;
this.vmName = name;
this.isMarketplaceLinuxImage = false;
this.namer = SdkContext.getResourceNamerFactory().createResourceNamer(this.vmName);
this.creatableSecondaryNetworkInterfaceKeys = new ArrayList<>();
this.existingSecondaryNetworkInterfacesToAssociate = new ArrayList<>();
this.virtualMachineSizeConverter = new PagedListConverter<VirtualMachineSizeInner, VirtualMachineSize>() {
@Override
public Observable<VirtualMachineSize> typeConvertAsync(VirtualMachineSizeInner inner) {
return Observable.just((VirtualMachineSize) new VirtualMachineSizeImpl(inner));
}
};
this.virtualMachineExtensions = new VirtualMachineExtensionsImpl(computeManager.inner().virtualMachineExtensions(), this);
this.managedDataDisks = new ManagedDataDiskCollection(this);
initializeDataDisks();
this.bootDiagnosticsHandler = new BootDiagnosticsHandler(this);
this.virtualMachineMsiHandler = new VirtualMachineMsiHandler(rbacManager, this);
}
示例5: availableSizes
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public PagedList<VirtualMachineSize> availableSizes() {
PageImpl<VirtualMachineSizeInner> page = new PageImpl<>();
page.setItems(this.manager().inner().virtualMachines().listAvailableSizes(this.resourceGroupName(), this.name()));
page.setNextPageLink(null);
return this.virtualMachineSizeConverter.convert(new PagedList<VirtualMachineSizeInner>(page) {
@Override
public Page<VirtualMachineSizeInner> nextPage(String nextPageLink) {
return null;
}
});
}
示例6: VirtualMachineSizeInRegion
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
public VirtualMachineSizeInRegion(
VirtualMachineSize delegate, Location region) {
checkNotNull(region, "region is null");
this.region = region;
checkNotNull(delegate, "delegate is null");
this.delegate = delegate;
regionScopedId = IdScopeByLocations.from(region.id(), delegate.name()).getIdWithLocation();
}
示例7: doRequest
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public List<VirtualMachineSize> doRequest(Azure api) throws AzureException {
PagedList<VirtualMachineSize> sizes;
try {
sizes = api.virtualMachines().sizes().listByRegion(this.region);
} catch (Exception e) {
throw new AzureException("failed to get vm sizes: " + e.getMessage(), e);
}
return new ArrayList<>(sizes);
}
示例8: main
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
public static void main(String[] args) {
AzureApiAccess apiAccess = new AzureApiAccess(SUBSCRIPTION_ID, AZURE_AUTH,
new TimeInterval(10L, TimeUnit.SECONDS), new TimeInterval(10L, TimeUnit.SECONDS), LogLevel.BASIC);
List<VirtualMachineSize> sizes = new ListVmSizesRequest(apiAccess, Region.findByLabelOrName(region)).call();
for (VirtualMachineSize size : sizes) {
LOG.info("size: {}: {} cores, {} MB memory", size.name(), size.numberOfCores(), size.memoryInMB());
}
}
示例9: virtualMachines
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
@Cacheable(cacheNames = "cloudResourceVmTypeCache", key = "#cloudCredential?.id + #region.getRegionName()")
public CloudVmTypes virtualMachines(CloudCredential cloudCredential, Region region, Map<String, String> filters) throws IOException {
AzureClient client = azureClientService.getClient(cloudCredential);
Set<VirtualMachineSize> vmTypes = client.getVmTypes(region.value());
Map<String, Set<VmType>> cloudVmResponses = new HashMap<>();
Map<String, VmType> defaultCloudVmResponses = new HashMap<>();
Set<VmType> types = new HashSet<>();
VmType defaultVmType = null;
for (VirtualMachineSize virtualMachineSize : vmTypes) {
float memoryInGB = virtualMachineSize.memoryInMB() / NO_MB_PER_GB;
VmTypeMeta.VmTypeMetaBuilder builder = VmTypeMeta.VmTypeMetaBuilder.builder()
.withCpuAndMemory(virtualMachineSize.numberOfCores(), memoryInGB);
for (VolumeParameterType volumeParameterType : values()) {
switch (volumeParameterType) {
case MAGNETIC:
builder.withMagneticConfig(volumeParameterConfig(MAGNETIC, virtualMachineSize));
break;
default:
break;
}
}
VmType vmType = VmType.vmTypeWithMeta(virtualMachineSize.name(), builder.create(), true);
types.add(vmType);
if (virtualMachineSize.name().equals(armVmDefault)) {
defaultVmType = vmType;
}
}
cloudVmResponses.put(region.value(), types);
defaultCloudVmResponses.put(region.value(), defaultVmType);
return new CloudVmTypes(cloudVmResponses, defaultCloudVmResponses);
}
示例10: volumeParameterConfig
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
private VolumeParameterConfig volumeParameterConfig(VolumeParameterType volumeParameterType, VirtualMachineSize virtualMachineSize) {
return new VolumeParameterConfig(
volumeParameterType,
Integer.valueOf(DEFAULT_MINIMUM_VOLUME_SIZE),
Integer.valueOf(DEFAULT_MAXIMUM_VOLUME_SIZE),
Integer.valueOf(DEFAULT_MINIMUM_VOLUME_COUNT),
virtualMachineSize.maxDataDiskCount());
}
示例11: listByRegion
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public PagedList<VirtualMachineSize> listByRegion(Region region) {
return listByRegion(region.toString());
}
示例12: listByRegionAsync
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public Observable<VirtualMachineSize> listByRegionAsync(Region region) {
return listByRegionAsync(region.name());
}
示例13: listFlavors
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public List<VirtualMachineSize> listFlavors() {
return null;
}
示例14: getAllElement
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
private Set<VirtualMachineSize> getAllElement(PagedList<VirtualMachineSize> virtualMachineSizes, Set<VirtualMachineSize> resultList) {
resultList.addAll(virtualMachineSizes);
return resultList;
}
示例15: listFlavors
import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
List<VirtualMachineSize> listFlavors();