1. Packages
  2. Opennebula Provider
  3. API Docs
  4. getTemplates
opennebula 1.4.1 published on Monday, Apr 14, 2025 by opennebula

opennebula.getTemplates

Explore with Pulumi AI

opennebula logo
opennebula 1.4.1 published on Monday, Apr 14, 2025 by opennebula

    Use this data source to retrieve templates information.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as opennebula from "@pulumi/opennebula";
    
    const example = opennebula.getTemplates({
        hasCpu: true,
        nameRegex: "test.*",
        order: "ASC",
        sortOn: "register_date",
    });
    
    import pulumi
    import pulumi_opennebula as opennebula
    
    example = opennebula.get_templates(has_cpu=True,
        name_regex="test.*",
        order="ASC",
        sort_on="register_date")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/opennebula/opennebula"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := opennebula.GetTemplates(ctx, &opennebula.GetTemplatesArgs{
    			HasCpu:    pulumi.BoolRef(true),
    			NameRegex: pulumi.StringRef("test.*"),
    			Order:     pulumi.StringRef("ASC"),
    			SortOn:    pulumi.StringRef("register_date"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Opennebula = Pulumi.Opennebula;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Opennebula.GetTemplates.Invoke(new()
        {
            HasCpu = true,
            NameRegex = "test.*",
            Order = "ASC",
            SortOn = "register_date",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.opennebula.OpennebulaFunctions;
    import com.pulumi.opennebula.inputs.GetTemplatesArgs;
    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) {
            final var example = OpennebulaFunctions.getTemplates(GetTemplatesArgs.builder()
                .hasCpu(true)
                .nameRegex("test.*")
                .order("ASC")
                .sortOn("register_date")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: opennebula:getTemplates
          arguments:
            hasCpu: true
            nameRegex: test.*
            order: ASC
            sortOn: register_date
    

    Templates attributes

    • id - ID of the template.
    • name - Name of the template.
    • cpu - Amount of CPU shares assigned to the VM.
    • vcpu - Number of CPU cores presented to the VM.
    • memory - Amount of RAM assigned to the VM in MB.
    • disk - Disk parameters
    • nic - NIC parameters
    • vmgroup - VM group parameters
    • register_date - Creation date of the template
    • tags - Tags of the template (Key = Value).

    Using getTemplates

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getTemplates(args: GetTemplatesArgs, opts?: InvokeOptions): Promise<GetTemplatesResult>
    function getTemplatesOutput(args: GetTemplatesOutputArgs, opts?: InvokeOptions): Output<GetTemplatesResult>
    def get_templates(cpu: Optional[float] = None,
                      has_cpu: Optional[bool] = None,
                      has_memory: Optional[bool] = None,
                      has_vcpu: Optional[bool] = None,
                      id: Optional[str] = None,
                      memory: Optional[float] = None,
                      name_regex: Optional[str] = None,
                      order: Optional[str] = None,
                      sort_on: Optional[str] = None,
                      tags: Optional[Mapping[str, str]] = None,
                      vcpu: Optional[float] = None,
                      opts: Optional[InvokeOptions] = None) -> GetTemplatesResult
    def get_templates_output(cpu: Optional[pulumi.Input[float]] = None,
                      has_cpu: Optional[pulumi.Input[bool]] = None,
                      has_memory: Optional[pulumi.Input[bool]] = None,
                      has_vcpu: Optional[pulumi.Input[bool]] = None,
                      id: Optional[pulumi.Input[str]] = None,
                      memory: Optional[pulumi.Input[float]] = None,
                      name_regex: Optional[pulumi.Input[str]] = None,
                      order: Optional[pulumi.Input[str]] = None,
                      sort_on: Optional[pulumi.Input[str]] = None,
                      tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                      vcpu: Optional[pulumi.Input[float]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetTemplatesResult]
    func GetTemplates(ctx *Context, args *GetTemplatesArgs, opts ...InvokeOption) (*GetTemplatesResult, error)
    func GetTemplatesOutput(ctx *Context, args *GetTemplatesOutputArgs, opts ...InvokeOption) GetTemplatesResultOutput

    > Note: This function is named GetTemplates in the Go SDK.

    public static class GetTemplates 
    {
        public static Task<GetTemplatesResult> InvokeAsync(GetTemplatesArgs args, InvokeOptions? opts = null)
        public static Output<GetTemplatesResult> Invoke(GetTemplatesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetTemplatesResult> getTemplates(GetTemplatesArgs args, InvokeOptions options)
    public static Output<GetTemplatesResult> getTemplates(GetTemplatesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: opennebula:index/getTemplates:getTemplates
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Cpu double
    Amount of CPU shares assigned to the VM.
    HasCpu bool
    Indicate if a CPU value has been defined.
    HasMemory bool
    Indicate if a memory value has been defined.
    HasVcpu bool
    Indicate if a VCPU value has been defined.
    Id string
    Memory double
    Amount of RAM assigned to the VM in MB.
    NameRegex string
    Filter templates by name with a RE2 regular expression.
    Order string
    Ordering of the sort: ASC or DESC.
    SortOn string
    Tags Dictionary<string, string>
    Template tags (Key = Value).
    Vcpu double
    Number of CPU cores presented to the VM.
    Cpu float64
    Amount of CPU shares assigned to the VM.
    HasCpu bool
    Indicate if a CPU value has been defined.
    HasMemory bool
    Indicate if a memory value has been defined.
    HasVcpu bool
    Indicate if a VCPU value has been defined.
    Id string
    Memory float64
    Amount of RAM assigned to the VM in MB.
    NameRegex string
    Filter templates by name with a RE2 regular expression.
    Order string
    Ordering of the sort: ASC or DESC.
    SortOn string
    Tags map[string]string
    Template tags (Key = Value).
    Vcpu float64
    Number of CPU cores presented to the VM.
    cpu Double
    Amount of CPU shares assigned to the VM.
    hasCpu Boolean
    Indicate if a CPU value has been defined.
    hasMemory Boolean
    Indicate if a memory value has been defined.
    hasVcpu Boolean
    Indicate if a VCPU value has been defined.
    id String
    memory Double
    Amount of RAM assigned to the VM in MB.
    nameRegex String
    Filter templates by name with a RE2 regular expression.
    order String
    Ordering of the sort: ASC or DESC.
    sortOn String
    tags Map<String,String>
    Template tags (Key = Value).
    vcpu Double
    Number of CPU cores presented to the VM.
    cpu number
    Amount of CPU shares assigned to the VM.
    hasCpu boolean
    Indicate if a CPU value has been defined.
    hasMemory boolean
    Indicate if a memory value has been defined.
    hasVcpu boolean
    Indicate if a VCPU value has been defined.
    id string
    memory number
    Amount of RAM assigned to the VM in MB.
    nameRegex string
    Filter templates by name with a RE2 regular expression.
    order string
    Ordering of the sort: ASC or DESC.
    sortOn string
    tags {[key: string]: string}
    Template tags (Key = Value).
    vcpu number
    Number of CPU cores presented to the VM.
    cpu float
    Amount of CPU shares assigned to the VM.
    has_cpu bool
    Indicate if a CPU value has been defined.
    has_memory bool
    Indicate if a memory value has been defined.
    has_vcpu bool
    Indicate if a VCPU value has been defined.
    id str
    memory float
    Amount of RAM assigned to the VM in MB.
    name_regex str
    Filter templates by name with a RE2 regular expression.
    order str
    Ordering of the sort: ASC or DESC.
    sort_on str
    tags Mapping[str, str]
    Template tags (Key = Value).
    vcpu float
    Number of CPU cores presented to the VM.
    cpu Number
    Amount of CPU shares assigned to the VM.
    hasCpu Boolean
    Indicate if a CPU value has been defined.
    hasMemory Boolean
    Indicate if a memory value has been defined.
    hasVcpu Boolean
    Indicate if a VCPU value has been defined.
    id String
    memory Number
    Amount of RAM assigned to the VM in MB.
    nameRegex String
    Filter templates by name with a RE2 regular expression.
    order String
    Ordering of the sort: ASC or DESC.
    sortOn String
    tags Map<String>
    Template tags (Key = Value).
    vcpu Number
    Number of CPU cores presented to the VM.

    getTemplates Result

    The following output properties are available:

    Cpu double
    Id string
    Memory double
    Templates List<GetTemplatesTemplate>
    For each filtered template, this section collect a list of attributes. See templates attributes
    Vcpu double
    HasCpu bool
    HasMemory bool
    HasVcpu bool
    NameRegex string
    Order string
    SortOn string
    Tags Dictionary<string, string>
    Cpu float64
    Id string
    Memory float64
    Templates []GetTemplatesTemplate
    For each filtered template, this section collect a list of attributes. See templates attributes
    Vcpu float64
    HasCpu bool
    HasMemory bool
    HasVcpu bool
    NameRegex string
    Order string
    SortOn string
    Tags map[string]string
    cpu Double
    id String
    memory Double
    templates List<GetTemplatesTemplate>
    For each filtered template, this section collect a list of attributes. See templates attributes
    vcpu Double
    hasCpu Boolean
    hasMemory Boolean
    hasVcpu Boolean
    nameRegex String
    order String
    sortOn String
    tags Map<String,String>
    cpu number
    id string
    memory number
    templates GetTemplatesTemplate[]
    For each filtered template, this section collect a list of attributes. See templates attributes
    vcpu number
    hasCpu boolean
    hasMemory boolean
    hasVcpu boolean
    nameRegex string
    order string
    sortOn string
    tags {[key: string]: string}
    cpu float
    id str
    memory float
    templates Sequence[GetTemplatesTemplate]
    For each filtered template, this section collect a list of attributes. See templates attributes
    vcpu float
    has_cpu bool
    has_memory bool
    has_vcpu bool
    name_regex str
    order str
    sort_on str
    tags Mapping[str, str]
    cpu Number
    id String
    memory Number
    templates List<Property Map>
    For each filtered template, this section collect a list of attributes. See templates attributes
    vcpu Number
    hasCpu Boolean
    hasMemory Boolean
    hasVcpu Boolean
    nameRegex String
    order String
    sortOn String
    tags Map<String>

    Supporting Types

    GetTemplatesTemplate

    Cpu double
    Amount of CPU shares assigned to the VM.
    Disks List<GetTemplatesTemplateDisk>
    Id double
    Memory double
    Amount of RAM assigned to the VM in MB.
    Name string
    Nics List<GetTemplatesTemplateNic>
    RegisterDate double
    Tags Dictionary<string, string>
    Template tags (Key = Value).
    Vcpu double
    Number of CPU cores presented to the VM.
    Vmgroups List<GetTemplatesTemplateVmgroup>
    Cpu float64
    Amount of CPU shares assigned to the VM.
    Disks []GetTemplatesTemplateDisk
    Id float64
    Memory float64
    Amount of RAM assigned to the VM in MB.
    Name string
    Nics []GetTemplatesTemplateNic
    RegisterDate float64
    Tags map[string]string
    Template tags (Key = Value).
    Vcpu float64
    Number of CPU cores presented to the VM.
    Vmgroups []GetTemplatesTemplateVmgroup
    cpu Double
    Amount of CPU shares assigned to the VM.
    disks List<GetTemplatesTemplateDisk>
    id Double
    memory Double
    Amount of RAM assigned to the VM in MB.
    name String
    nics List<GetTemplatesTemplateNic>
    registerDate Double
    tags Map<String,String>
    Template tags (Key = Value).
    vcpu Double
    Number of CPU cores presented to the VM.
    vmgroups List<GetTemplatesTemplateVmgroup>
    cpu number
    Amount of CPU shares assigned to the VM.
    disks GetTemplatesTemplateDisk[]
    id number
    memory number
    Amount of RAM assigned to the VM in MB.
    name string
    nics GetTemplatesTemplateNic[]
    registerDate number
    tags {[key: string]: string}
    Template tags (Key = Value).
    vcpu number
    Number of CPU cores presented to the VM.
    vmgroups GetTemplatesTemplateVmgroup[]
    cpu float
    Amount of CPU shares assigned to the VM.
    disks Sequence[GetTemplatesTemplateDisk]
    id float
    memory float
    Amount of RAM assigned to the VM in MB.
    name str
    nics Sequence[GetTemplatesTemplateNic]
    register_date float
    tags Mapping[str, str]
    Template tags (Key = Value).
    vcpu float
    Number of CPU cores presented to the VM.
    vmgroups Sequence[GetTemplatesTemplateVmgroup]
    cpu Number
    Amount of CPU shares assigned to the VM.
    disks List<Property Map>
    id Number
    memory Number
    Amount of RAM assigned to the VM in MB.
    name String
    nics List<Property Map>
    registerDate Number
    tags Map<String>
    Template tags (Key = Value).
    vcpu Number
    Number of CPU cores presented to the VM.
    vmgroups List<Property Map>

    GetTemplatesTemplateDisk

    Cache string
    DevPrefix string
    Discard string
    Driver string
    ImageId double
    Io string
    Size double
    Target string
    VolatileFormat string
    VolatileType string
    Cache string
    DevPrefix string
    Discard string
    Driver string
    ImageId float64
    Io string
    Size float64
    Target string
    VolatileFormat string
    VolatileType string
    cache String
    devPrefix String
    discard String
    driver String
    imageId Double
    io String
    size Double
    target String
    volatileFormat String
    volatileType String
    cache string
    devPrefix string
    discard string
    driver string
    imageId number
    io string
    size number
    target string
    volatileFormat string
    volatileType string
    cache String
    devPrefix String
    discard String
    driver String
    imageId Number
    io String
    size Number
    target String
    volatileFormat String
    volatileType String

    GetTemplatesTemplateNic

    Dns string
    Gateway string
    Ip string
    Mac string
    Method string
    Model string
    Network string
    NetworkId double
    NetworkModeAuto bool
    PhysicalDevice string
    SchedRank string
    SchedRequirements string
    SecurityGroups List<double>
    VirtioQueues string
    Dns string
    Gateway string
    Ip string
    Mac string
    Method string
    Model string
    Network string
    NetworkId float64
    NetworkModeAuto bool
    PhysicalDevice string
    SchedRank string
    SchedRequirements string
    SecurityGroups []float64
    VirtioQueues string
    dns String
    gateway String
    ip String
    mac String
    method String
    model String
    network String
    networkId Double
    networkModeAuto Boolean
    physicalDevice String
    schedRank String
    schedRequirements String
    securityGroups List<Double>
    virtioQueues String
    dns string
    gateway string
    ip string
    mac string
    method string
    model string
    network string
    networkId number
    networkModeAuto boolean
    physicalDevice string
    schedRank string
    schedRequirements string
    securityGroups number[]
    virtioQueues string
    dns String
    gateway String
    ip String
    mac String
    method String
    model String
    network String
    networkId Number
    networkModeAuto Boolean
    physicalDevice String
    schedRank String
    schedRequirements String
    securityGroups List<Number>
    virtioQueues String

    GetTemplatesTemplateVmgroup

    Role string
    VmgroupId double
    Role string
    VmgroupId float64
    role String
    vmgroupId Double
    role string
    vmgroupId number
    role str
    vmgroup_id float
    role String
    vmgroupId Number

    Package Details

    Repository
    opennebula opennebula/terraform-provider-opennebula
    License
    Notes
    This Pulumi package is based on the opennebula Terraform Provider.
    opennebula logo
    opennebula 1.4.1 published on Monday, Apr 14, 2025 by opennebula