• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VirtualMachineSize类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:22,代码来源:TestVirtualMachineSizes.java


示例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;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:20,代码来源:TestVirtualMachineSizes.java


示例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;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:18,代码来源:TestAvailabilitySet.java


示例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);
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:28,代码来源:VirtualMachineImpl.java


示例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;
        }
    });
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:13,代码来源:VirtualMachineImpl.java


示例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();
}
 
开发者ID:cloudiator,项目名称:sword,代码行数:9,代码来源:VirtualMachineSizeInRegion.java


示例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);
}
 
开发者ID:elastisys,项目名称:scale.cloudpool,代码行数:12,代码来源:ListVmSizesRequest.java


示例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());
        }
    }
 
开发者ID:elastisys,项目名称:scale.cloudpool,代码行数:11,代码来源:ListVmSizes.java


示例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);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:37,代码来源:AzurePlatformResources.java


示例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());
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:9,代码来源:AzurePlatformResources.java


示例11: listByRegion

import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public PagedList<VirtualMachineSize> listByRegion(Region region) {
    return listByRegion(region.toString());
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:5,代码来源:VirtualMachineSizesImpl.java


示例12: listByRegionAsync

import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public Observable<VirtualMachineSize> listByRegionAsync(Region region) {
    return listByRegionAsync(region.name());
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:5,代码来源:VirtualMachineSizesImpl.java


示例13: listFlavors

import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
@Override
public List<VirtualMachineSize> listFlavors() {
    return null;
}
 
开发者ID:meridor,项目名称:perspective-backend,代码行数:5,代码来源:ApiProviderImpl.java


示例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;
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:5,代码来源:AzureClient.java


示例15: listFlavors

import com.microsoft.azure.management.compute.VirtualMachineSize; //导入依赖的package包/类
List<VirtualMachineSize> listFlavors(); 
开发者ID:meridor,项目名称:perspective-backend,代码行数:2,代码来源:Api.java



注:本文中的com.microsoft.azure.management.compute.VirtualMachineSize类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ResourceMappings类代码示例发布时间:2022-05-22
下一篇:
Java DefaultVersionResolver类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap