// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.vmwarecloudsimple.generated;

import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.ResourcePoolInner;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.VirtualNetworkInner;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.VirtualNicInner;
import com.azure.resourcemanager.vmwarecloudsimple.models.DiskIndependenceMode;
import com.azure.resourcemanager.vmwarecloudsimple.models.NicType;
import com.azure.resourcemanager.vmwarecloudsimple.models.VirtualDisk;
import java.util.Arrays;

/** Samples for VirtualMachines CreateOrUpdate. */
public final class VirtualMachinesCreateOrUpdateSamples {
    /*
     * x-ms-original-file: specification/vmwarecloudsimple/resource-manager/Microsoft.VMwareCloudSimple/stable/2019-04-01/examples/CreateVirtualMachine.json
     */
    /**
     * Sample code: CreateVirtualMachine.
     *
     * @param manager Entry point to VMwareCloudSimpleManager.
     */
    public static void createVirtualMachine(
        com.azure.resourcemanager.vmwarecloudsimple.VMwareCloudSimpleManager manager) {
        manager
            .virtualMachines()
            .define("myVirtualMachine")
            .withRegion("westus2")
            .withExistingResourceGroup("myResourceGroup")
            .withAmountOfRam(4096)
            .withDisks(
                Arrays
                    .asList(
                        new VirtualDisk()
                            .withControllerId("1000")
                            .withIndependenceMode(DiskIndependenceMode.PERSISTENT)
                            .withTotalSize(10485760)
                            .withVirtualDiskId("2000")))
            .withNics(
                Arrays
                    .asList(
                        new VirtualNicInner()
                            .withNetwork(
                                new VirtualNetworkInner()
                                    .withId(
                                        "/subscriptions/{subscription-id}/providers/Microsoft.VMwareCloudSimple/locations/westus2/privateClouds/myPrivateCloud/virtualNetworks/dvportgroup-19"))
                            .withNicType(NicType.E1000)
                            .withPowerOnBoot(true)
                            .withVirtualNicId("4000")))
            .withNumberOfCores(2)
            .withPrivateCloudId(
                "/subscriptions/{subscription-id}/providers/Microsoft.VMwareCloudSimple/locations/westus2/privateClouds/myPrivateCloud")
            .withResourcePool(
                new ResourcePoolInner()
                    .withId(
                        "/subscriptions/{subscription-id}/providers/Microsoft.VMwareCloudSimple/locations/westus2/privateClouds/myPrivateCloud/resourcePools/resgroup-26"))
            .withTemplateId(
                "/subscriptions/{subscription-id}/providers/Microsoft.VMwareCloudSimple/locations/westus2/privateClouds/myPrivateCloud/virtualMachineTemplates/vm-34")
            .withReferer("https://management.azure.com/")
            .create();
    }
}
