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

Java AvailabilitySet类代码示例

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

本文整理汇总了Java中com.microsoft.azure.management.compute.AvailabilitySet的典型用法代码示例。如果您正苦于以下问题:Java AvailabilitySet类的具体用法?Java AvailabilitySet怎么用?Java AvailabilitySet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AvailabilitySet类属于com.microsoft.azure.management.compute包,在下文中一共展示了AvailabilitySet类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createResourceAsync

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public Observable<AvailabilitySet> createResourceAsync() {
    final AvailabilitySetImpl self = this;
    if (this.inner().platformFaultDomainCount() == null) {
        this.inner().withPlatformFaultDomainCount(2);
    }
    if (this.inner().platformUpdateDomainCount() == null) {
        this.inner().withPlatformUpdateDomainCount(5);
    }
    return this.manager().inner().availabilitySets().createOrUpdateAsync(resourceGroupName(), name(), inner())
            .map(new Func1<AvailabilitySetInner, AvailabilitySet>() {
                @Override
                public AvailabilitySet call(AvailabilitySetInner availabilitySetInner) {
                    self.setInner(availabilitySetInner);
                    idOfVMsInSet = null;
                    return self;
                }
            });
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:20,代码来源:AvailabilitySetImpl.java


示例2: withNewAvailabilitySet

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public VirtualMachineImpl withNewAvailabilitySet(String name) {
    AvailabilitySet.DefinitionStages.WithGroup definitionWithGroup = super.myManager
            .availabilitySets()
            .define(name)
            .withRegion(this.regionName());
    AvailabilitySet.DefinitionStages.WithSku definitionWithSku;
    if (this.creatableGroup != null) {
        definitionWithSku = definitionWithGroup.withNewResourceGroup(this.creatableGroup);
    } else {
        definitionWithSku = definitionWithGroup.withExistingResourceGroup(this.resourceGroupName());
    }
    Creatable<AvailabilitySet> creatable;
    if (isManagedDiskEnabled()) {
        creatable = definitionWithSku.withSku(AvailabilitySetSkuTypes.MANAGED);
    } else {
        creatable = definitionWithSku.withSku(AvailabilitySetSkuTypes.UNMANAGED);
    }
    return withNewAvailabilitySet(creatable);
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:21,代码来源:VirtualMachineImpl.java


示例3: handleAvailabilitySettings

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
private void handleAvailabilitySettings() {
    if (!isInCreateMode()) {
        return;
    }

    AvailabilitySet availabilitySet = null;
    if (this.creatableAvailabilitySetKey != null) {
        availabilitySet = this.<AvailabilitySet>taskResult(this.creatableAvailabilitySetKey);
    } else if (this.existingAvailabilitySetToAssociate != null) {
        availabilitySet = this.existingAvailabilitySetToAssociate;
    }

    if (availabilitySet != null) {
        if (this.inner().availabilitySet() == null) {
            this.inner().withAvailabilitySet(new SubResource());
        }

        this.inner().availabilitySet().withId(availabilitySet.id());
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:21,代码来源:VirtualMachineImpl.java


示例4: createResource

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的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


示例5: print

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
/**
 * Print availability set info.
 *
 * @param resource an availability set
 */
public static void print(AvailabilitySet resource) {

    System.out.println(new StringBuilder().append("Availability Set: ").append(resource.id())
            .append("Name: ").append(resource.name())
            .append("\n\tResource group: ").append(resource.resourceGroupName())
            .append("\n\tRegion: ").append(resource.region())
            .append("\n\tTags: ").append(resource.tags())
            .append("\n\tFault domain count: ").append(resource.faultDomainCount())
            .append("\n\tUpdate domain count: ").append(resource.updateDomainCount())
            .toString());
}
 
开发者ID:Azure-Samples,项目名称:acr-java-manage-azure-container-registry,代码行数:17,代码来源:Utils.java


示例6: refreshAsync

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public Observable<AvailabilitySet> refreshAsync() {
    return super.refreshAsync().map(new Func1<AvailabilitySet, AvailabilitySet>() {
        @Override
        public AvailabilitySet call(AvailabilitySet availabilitySet) {
            AvailabilitySetImpl impl = (AvailabilitySetImpl) availabilitySet;
            impl.idOfVMsInSet = null;
            return impl;
        }
    });
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:12,代码来源:AvailabilitySetImpl.java


示例7: list

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public PagedList<AvailabilitySet> list() {
    final AvailabilitySetsImpl self = this;
    return new GroupPagedList<AvailabilitySet>(this.manager().resourceManager().resourceGroups().list()) {
        @Override
        public List<AvailabilitySet> listNextGroup(String resourceGroupName) {
            return wrapList(self.inner().listByResourceGroup(resourceGroupName));
        }
    };
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:11,代码来源:AvailabilitySetsImpl.java


示例8: listAsync

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public Observable<AvailabilitySet> listAsync() {
    return this.manager().resourceManager().resourceGroups().listAsync()
            .flatMap(new Func1<ResourceGroup, Observable<AvailabilitySet>>() {
                @Override
                public Observable<AvailabilitySet> call(ResourceGroup resourceGroup) {
                    return wrapPageAsync(inner().listByResourceGroupAsync(resourceGroup.name()));
                }
            });
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:11,代码来源:AvailabilitySetsImpl.java


示例9: updateResource

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public AvailabilitySet updateResource(AvailabilitySet resource) throws Exception {
    // Modify existing availability set
    resource =  resource.update()
            .withTag("tag2", "value2")
            .withTag("tag3", "value3")
            .withoutTag("tag1")
            .apply();
    Assert.assertTrue(resource.tags().containsKey("tag2"));
    Assert.assertTrue(!resource.tags().containsKey("tag1"));
    return resource;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:13,代码来源:TestAvailabilitySet.java


示例10: print

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public void print(AvailabilitySet resource) {
    System.out.println(new StringBuilder().append("Availability Set: ").append(resource.id())
            .append("Name: ").append(resource.name())
            .append("\n\tResource group: ").append(resource.resourceGroupName())
            .append("\n\tRegion: ").append(resource.region())
            .append("\n\tTags: ").append(resource.tags())
            .append("\n\tFault domain count: ").append(resource.faultDomainCount())
            .append("\n\tUpdate domain count: ").append(resource.updateDomainCount())
            .toString());
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:12,代码来源:TestAvailabilitySet.java


示例11: windowsVmDefinition

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
private Creatable<VirtualMachine> windowsVmDefinition(VmSpec vmSpec, WithOS rawVmDef) {
    VmImage vmImage = vmSpec.getVmImage();
    WindowsSettings windowsSettings = vmSpec.getWindowsSettings().get();

    // NOTE: due to the poor azure SDK design we need two separate, almost
    // identical, VM builder call sequences depending on if using an
    // Azure-managed VM image or a private VM image.
    WithFromImageCreateOptionsManaged windowsVm;
    if (vmImage.isImageReference()) {
        windowsVm = rawVmDef.withSpecificWindowsImageVersion(vmImage.getImageReference()) //
                .withAdminUsername(windowsSettings.getAdminUserName()) //
                .withAdminPassword(windowsSettings.getPassword()) //
                .withComputerName(vmSpec.getVmName());
    } else {
        windowsVm = rawVmDef.withWindowsCustomImage(vmImage.getImageId()) //
                .withAdminUsername(windowsSettings.getAdminUserName()) //
                .withAdminPassword(windowsSettings.getPassword()) //
                .withComputerName(vmSpec.getVmName());
    }
    windowsVm.withOSDiskName(vmSpec.getVmName());
    windowsVm.withOSDiskStorageAccountType(vmSpec.getOsDiskType());

    // if specified, add VM to availability set
    if (vmSpec.getAvailabilitySet().isPresent()) {
        String availabilitySet = vmSpec.getAvailabilitySet().get();
        AvailabilitySet set = new GetAvailabilitySetRequest(this.apiAccess, this.resourceGroup, availabilitySet)
                .call();
        windowsVm.withExistingAvailabilitySet(set);
    }

    windowsVm.withTags(vmSpec.getTags());

    // add custom boot script to be executed
    CustomScriptExtension customScript = windowsSettings.getCustomScript();
    if (customScript != null) {
        attachWindowsCustomScript(windowsVm, customScript);
    }
    return windowsVm;
}
 
开发者ID:elastisys,项目名称:scale.cloudpool,代码行数:40,代码来源:VmLauncher.java


示例12: doRequest

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public AvailabilitySet doRequest(Azure api) throws NotFoundException, AzureException {
    AvailabilitySet as;
    try {
        LOG.debug("retrieving availability set {} ...", this.availabilitySetName);
        as = api.availabilitySets().getByResourceGroup(this.resourceGroup, this.availabilitySetName);
    } catch (Exception e) {
        throw new AzureException("failed to get availability set: " + e.getMessage(), e);
    }

    return Optional.ofNullable(as).orElseThrow(() -> notFoundError());
}
 
开发者ID:elastisys,项目名称:scale.cloudpool,代码行数:13,代码来源:GetAvailabilitySetRequest.java


示例13: main

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的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);

        AvailabilitySet as = new GetAvailabilitySetRequest(apiAccess, resourceGroup, availabilitySetName).call();
        LOG.info("availability set: {}", as.id());
    }
 
开发者ID:elastisys,项目名称:scale.cloudpool,代码行数:9,代码来源:GetAvailabilitySet.java


示例14: listByResourceGroup

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public PagedList<AvailabilitySet> listByResourceGroup(String groupName) {
    return wrapList(this.inner().listByResourceGroup(groupName));
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:5,代码来源:AvailabilitySetsImpl.java


示例15: listByResourceGroupAsync

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public Observable<AvailabilitySet> listByResourceGroupAsync(String resourceGroupName) {
    return wrapPageAsync(this.inner().listByResourceGroupAsync(resourceGroupName));
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:5,代码来源:AvailabilitySetsImpl.java


示例16: withExistingAvailabilitySet

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
@Override
public VirtualMachineImpl withExistingAvailabilitySet(AvailabilitySet availabilitySet) {
    this.existingAvailabilitySetToAssociate = availabilitySet;
    return this;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:6,代码来源:VirtualMachineImpl.java


示例17: ensureVMs

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
private static VirtualMachine[] ensureVMs(Networks networks, ComputeManager computeManager, int count) throws Exception {
    // Create a network for the VMs
    Network network = networks.define("net" + TEST_ID)
            .withRegion(REGION)
            .withNewResourceGroup(GROUP_NAME)
            .withAddressSpace("10.0.0.0/28")
            .withSubnet("subnet1", "10.0.0.0/29")
            .withSubnet("subnet2", "10.0.0.8/29")
            .create();

    Creatable<AvailabilitySet> availabilitySetDefinition = computeManager.availabilitySets().define("as" + TEST_ID)
            .withRegion(REGION)
            .withExistingResourceGroup(GROUP_NAME)
            .withSku(AvailabilitySetSkuTypes.MANAGED);

    // Create the requested number of VM definitions
    String userName = "testuser" + TEST_ID;
    List<Creatable<VirtualMachine>> vmDefinitions = new ArrayList<>();
    for (int i = 0; i < count; i++) {
        String vmName = SdkContext.randomResourceName("vm", 15);

        Creatable<VirtualMachine> vm = computeManager.virtualMachines().define(vmName)
                .withRegion(REGION)
                .withExistingResourceGroup(GROUP_NAME)
                .withExistingPrimaryNetwork(network)
                .withSubnet(network.subnets().values().iterator().next().name())
                .withPrimaryPrivateIPAddressDynamic()
                .withoutPrimaryPublicIPAddress()
                .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
                .withRootUsername(userName)
                .withRootPassword("Abcdef.123456")
                .withNewAvailabilitySet(availabilitySetDefinition)
                .withSize(VirtualMachineSizeTypes.STANDARD_A1);

        vmDefinitions.add(vm);
    }

    CreatedResources<VirtualMachine> createdVMs2 = computeManager.virtualMachines().create(vmDefinitions);
    VirtualMachine[] array = new VirtualMachine[createdVMs2.size()];
    for (int index = 0; index < createdVMs2.size(); index++) {
        array[index] = createdVMs2.get(vmDefinitions.get(index).key());
    }
    return array;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:45,代码来源:TestLoadBalancer.java


示例18: linuxVmDefinition

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
private Creatable<VirtualMachine> linuxVmDefinition(VmSpec vmSpec, WithOS rawVmDef) {
    VmImage vmImage = vmSpec.getVmImage();
    LinuxSettings linuxSettings = vmSpec.getLinuxSettings().get();

    // NOTE: due to the poor azure SDK design we need two separate, almost
    // identical, VM builder call sequences depending on if using an
    // Azure-managed VM image or a private VM image.
    WithFromImageCreateOptionsManaged linuxVm;
    if (vmImage.isImageReference()) {
        linuxVm = rawVmDef.withSpecificLinuxImageVersion(vmImage.getImageReference()) //
                .withRootUsername(linuxSettings.getRootUserName()) //
                .withRootPassword(linuxSettings.getPassword()) //
                .withSsh(linuxSettings.getPublicSshKey()) //
                .withComputerName(vmSpec.getVmName());
    } else {
        linuxVm = rawVmDef.withLinuxCustomImage(vmImage.getImageId()) //
                .withRootUsername(linuxSettings.getRootUserName()) //
                .withRootPassword(linuxSettings.getPassword()) //
                .withSsh(linuxSettings.getPublicSshKey()) //
                .withComputerName(vmSpec.getVmName());
    }
    linuxVm.withOSDiskName(vmSpec.getVmName());
    linuxVm.withOSDiskStorageAccountType(vmSpec.getOsDiskType());

    // add custom data (for example, cloud-init script)
    if (linuxSettings.getCustomData() != null) {
        linuxVm.withCustomData(linuxSettings.getCustomData());
    }

    // if specified, add VM to availability set
    if (vmSpec.getAvailabilitySet().isPresent()) {
        String availabilitySet = vmSpec.getAvailabilitySet().get();
        AvailabilitySet set = new GetAvailabilitySetRequest(this.apiAccess, this.resourceGroup, availabilitySet)
                .call();
        linuxVm.withExistingAvailabilitySet(set);
    }

    linuxVm.withSize(vmSpec.getVmSize());
    linuxVm.withTags(vmSpec.getTags());

    // add custom boot script to be executed
    CustomScriptExtension customScript = linuxSettings.getCustomScript();
    if (customScript != null) {
        attachLinuxCustomScript(linuxVm, customScript);
    }
    return linuxVm;
}
 
开发者ID:elastisys,项目名称:scale.cloudpool,代码行数:48,代码来源:VmLauncher.java


示例19: getAvailabilitySet

import com.microsoft.azure.management.compute.AvailabilitySet; //导入依赖的package包/类
public AvailabilitySet getAvailabilitySet(String resourceGroup, String asName) {
    return handleAuthException(() -> azure.availabilitySets().getByResourceGroup(resourceGroup, asName));
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:4,代码来源:AzureClient.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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