1. Packages
  2. Vsphere Provider
  3. API Docs
  4. VirtualMachineClass
vSphere v4.12.1 published on Tuesday, Oct 22, 2024 by Pulumi

vsphere.VirtualMachineClass

Explore with Pulumi AI

vsphere logo
vSphere v4.12.1 published on Tuesday, Oct 22, 2024 by Pulumi

    Provides a resource for configuring a Virtual Machine class.

    Example Usage

    S

    Create a basic class

    import * as pulumi from "@pulumi/pulumi";
    import * as vsphere from "@pulumi/vsphere";
    
    const basicClass = new vsphere.VirtualMachineClass("basic_class", {
        name: "basic-class",
        cpus: 4,
        memory: 4096,
    });
    
    import pulumi
    import pulumi_vsphere as vsphere
    
    basic_class = vsphere.VirtualMachineClass("basic_class",
        name="basic-class",
        cpus=4,
        memory=4096)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vsphere.NewVirtualMachineClass(ctx, "basic_class", &vsphere.VirtualMachineClassArgs{
    			Name:   pulumi.String("basic-class"),
    			Cpus:   pulumi.Int(4),
    			Memory: pulumi.Int(4096),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using VSphere = Pulumi.VSphere;
    
    return await Deployment.RunAsync(() => 
    {
        var basicClass = new VSphere.VirtualMachineClass("basic_class", new()
        {
            Name = "basic-class",
            Cpus = 4,
            Memory = 4096,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vsphere.VirtualMachineClass;
    import com.pulumi.vsphere.VirtualMachineClassArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var basicClass = new VirtualMachineClass("basicClass", VirtualMachineClassArgs.builder()
                .name("basic-class")
                .cpus(4)
                .memory(4096)
                .build());
    
        }
    }
    
    resources:
      basicClass:
        type: vsphere:VirtualMachineClass
        name: basic_class
        properties:
          name: basic-class
          cpus: 4
          memory: 4096
    

    Create a class with a vGPU

    import * as pulumi from "@pulumi/pulumi";
    import * as vsphere from "@pulumi/vsphere";
    
    const vgpClass = new vsphere.VirtualMachineClass("vgp_class", {
        name: "vgpu-class",
        cpus: 4,
        memory: 4096,
        memoryReservation: 100,
        vgpuDevices: ["vgpu1"],
    });
    
    import pulumi
    import pulumi_vsphere as vsphere
    
    vgp_class = vsphere.VirtualMachineClass("vgp_class",
        name="vgpu-class",
        cpus=4,
        memory=4096,
        memory_reservation=100,
        vgpu_devices=["vgpu1"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vsphere.NewVirtualMachineClass(ctx, "vgp_class", &vsphere.VirtualMachineClassArgs{
    			Name:              pulumi.String("vgpu-class"),
    			Cpus:              pulumi.Int(4),
    			Memory:            pulumi.Int(4096),
    			MemoryReservation: pulumi.Int(100),
    			VgpuDevices: pulumi.StringArray{
    				pulumi.String("vgpu1"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using VSphere = Pulumi.VSphere;
    
    return await Deployment.RunAsync(() => 
    {
        var vgpClass = new VSphere.VirtualMachineClass("vgp_class", new()
        {
            Name = "vgpu-class",
            Cpus = 4,
            Memory = 4096,
            MemoryReservation = 100,
            VgpuDevices = new[]
            {
                "vgpu1",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vsphere.VirtualMachineClass;
    import com.pulumi.vsphere.VirtualMachineClassArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var vgpClass = new VirtualMachineClass("vgpClass", VirtualMachineClassArgs.builder()
                .name("vgpu-class")
                .cpus(4)
                .memory(4096)
                .memoryReservation(100)
                .vgpuDevices("vgpu1")
                .build());
    
        }
    }
    
    resources:
      vgpClass:
        type: vsphere:VirtualMachineClass
        name: vgp_class
        properties:
          name: vgpu-class
          cpus: 4
          memory: 4096
          memoryReservation: 100
          vgpuDevices:
            - vgpu1
    

    Create VirtualMachineClass Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new VirtualMachineClass(name: string, args: VirtualMachineClassArgs, opts?: CustomResourceOptions);
    @overload
    def VirtualMachineClass(resource_name: str,
                            args: VirtualMachineClassArgs,
                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def VirtualMachineClass(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            cpus: Optional[int] = None,
                            memory: Optional[int] = None,
                            cpu_reservation: Optional[int] = None,
                            memory_reservation: Optional[int] = None,
                            name: Optional[str] = None,
                            vgpu_devices: Optional[Sequence[str]] = None)
    func NewVirtualMachineClass(ctx *Context, name string, args VirtualMachineClassArgs, opts ...ResourceOption) (*VirtualMachineClass, error)
    public VirtualMachineClass(string name, VirtualMachineClassArgs args, CustomResourceOptions? opts = null)
    public VirtualMachineClass(String name, VirtualMachineClassArgs args)
    public VirtualMachineClass(String name, VirtualMachineClassArgs args, CustomResourceOptions options)
    
    type: vsphere:VirtualMachineClass
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args VirtualMachineClassArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args VirtualMachineClassArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args VirtualMachineClassArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VirtualMachineClassArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VirtualMachineClassArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var virtualMachineClassResource = new VSphere.VirtualMachineClass("virtualMachineClassResource", new()
    {
        Cpus = 0,
        Memory = 0,
        CpuReservation = 0,
        MemoryReservation = 0,
        Name = "string",
        VgpuDevices = new[]
        {
            "string",
        },
    });
    
    example, err := vsphere.NewVirtualMachineClass(ctx, "virtualMachineClassResource", &vsphere.VirtualMachineClassArgs{
    	Cpus:              pulumi.Int(0),
    	Memory:            pulumi.Int(0),
    	CpuReservation:    pulumi.Int(0),
    	MemoryReservation: pulumi.Int(0),
    	Name:              pulumi.String("string"),
    	VgpuDevices: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var virtualMachineClassResource = new VirtualMachineClass("virtualMachineClassResource", VirtualMachineClassArgs.builder()
        .cpus(0)
        .memory(0)
        .cpuReservation(0)
        .memoryReservation(0)
        .name("string")
        .vgpuDevices("string")
        .build());
    
    virtual_machine_class_resource = vsphere.VirtualMachineClass("virtualMachineClassResource",
        cpus=0,
        memory=0,
        cpu_reservation=0,
        memory_reservation=0,
        name="string",
        vgpu_devices=["string"])
    
    const virtualMachineClassResource = new vsphere.VirtualMachineClass("virtualMachineClassResource", {
        cpus: 0,
        memory: 0,
        cpuReservation: 0,
        memoryReservation: 0,
        name: "string",
        vgpuDevices: ["string"],
    });
    
    type: vsphere:VirtualMachineClass
    properties:
        cpuReservation: 0
        cpus: 0
        memory: 0
        memoryReservation: 0
        name: string
        vgpuDevices:
            - string
    

    VirtualMachineClass Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The VirtualMachineClass resource accepts the following input properties:

    Cpus int
    The number of CPUs.
    Memory int
    The amount of memory in MB.
    CpuReservation int
    The percentage of the available CPU capacity which will be reserved.
    MemoryReservation int
    The percentage of memory reservation.
    Name string
    The name for the class.
    VgpuDevices List<string>
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.
    Cpus int
    The number of CPUs.
    Memory int
    The amount of memory in MB.
    CpuReservation int
    The percentage of the available CPU capacity which will be reserved.
    MemoryReservation int
    The percentage of memory reservation.
    Name string
    The name for the class.
    VgpuDevices []string
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.
    cpus Integer
    The number of CPUs.
    memory Integer
    The amount of memory in MB.
    cpuReservation Integer
    The percentage of the available CPU capacity which will be reserved.
    memoryReservation Integer
    The percentage of memory reservation.
    name String
    The name for the class.
    vgpuDevices List<String>
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.
    cpus number
    The number of CPUs.
    memory number
    The amount of memory in MB.
    cpuReservation number
    The percentage of the available CPU capacity which will be reserved.
    memoryReservation number
    The percentage of memory reservation.
    name string
    The name for the class.
    vgpuDevices string[]
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.
    cpus int
    The number of CPUs.
    memory int
    The amount of memory in MB.
    cpu_reservation int
    The percentage of the available CPU capacity which will be reserved.
    memory_reservation int
    The percentage of memory reservation.
    name str
    The name for the class.
    vgpu_devices Sequence[str]
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.
    cpus Number
    The number of CPUs.
    memory Number
    The amount of memory in MB.
    cpuReservation Number
    The percentage of the available CPU capacity which will be reserved.
    memoryReservation Number
    The percentage of memory reservation.
    name String
    The name for the class.
    vgpuDevices List<String>
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VirtualMachineClass resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing VirtualMachineClass Resource

    Get an existing VirtualMachineClass resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: VirtualMachineClassState, opts?: CustomResourceOptions): VirtualMachineClass
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cpu_reservation: Optional[int] = None,
            cpus: Optional[int] = None,
            memory: Optional[int] = None,
            memory_reservation: Optional[int] = None,
            name: Optional[str] = None,
            vgpu_devices: Optional[Sequence[str]] = None) -> VirtualMachineClass
    func GetVirtualMachineClass(ctx *Context, name string, id IDInput, state *VirtualMachineClassState, opts ...ResourceOption) (*VirtualMachineClass, error)
    public static VirtualMachineClass Get(string name, Input<string> id, VirtualMachineClassState? state, CustomResourceOptions? opts = null)
    public static VirtualMachineClass get(String name, Output<String> id, VirtualMachineClassState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CpuReservation int
    The percentage of the available CPU capacity which will be reserved.
    Cpus int
    The number of CPUs.
    Memory int
    The amount of memory in MB.
    MemoryReservation int
    The percentage of memory reservation.
    Name string
    The name for the class.
    VgpuDevices List<string>
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.
    CpuReservation int
    The percentage of the available CPU capacity which will be reserved.
    Cpus int
    The number of CPUs.
    Memory int
    The amount of memory in MB.
    MemoryReservation int
    The percentage of memory reservation.
    Name string
    The name for the class.
    VgpuDevices []string
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.
    cpuReservation Integer
    The percentage of the available CPU capacity which will be reserved.
    cpus Integer
    The number of CPUs.
    memory Integer
    The amount of memory in MB.
    memoryReservation Integer
    The percentage of memory reservation.
    name String
    The name for the class.
    vgpuDevices List<String>
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.
    cpuReservation number
    The percentage of the available CPU capacity which will be reserved.
    cpus number
    The number of CPUs.
    memory number
    The amount of memory in MB.
    memoryReservation number
    The percentage of memory reservation.
    name string
    The name for the class.
    vgpuDevices string[]
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.
    cpu_reservation int
    The percentage of the available CPU capacity which will be reserved.
    cpus int
    The number of CPUs.
    memory int
    The amount of memory in MB.
    memory_reservation int
    The percentage of memory reservation.
    name str
    The name for the class.
    vgpu_devices Sequence[str]
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.
    cpuReservation Number
    The percentage of the available CPU capacity which will be reserved.
    cpus Number
    The number of CPUs.
    memory Number
    The amount of memory in MB.
    memoryReservation Number
    The percentage of memory reservation.
    name String
    The name for the class.
    vgpuDevices List<String>
    The identifiers of the vGPU devices for the class. If this is set memory reservation needs to be 100.

    Package Details

    Repository
    vSphere pulumi/pulumi-vsphere
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vsphere Terraform Provider.
    vsphere logo
    vSphere v4.12.1 published on Tuesday, Oct 22, 2024 by Pulumi