1. Packages
  2. Xen Orchestra
  3. API Docs
  4. ResourceSet
xenorchestra v1.5.2 published on Monday, Mar 10, 2025 by Vates

xenorchestra.ResourceSet

Explore with Pulumi AI

Creates a Xen Orchestra resource set.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as xenorchestra from "@pulumi/xenorchestra";
import * as xenorchestra from "@vates/pulumi-xenorchestra";

const template = xenorchestra.getXoaTemplate({
    nameLabel: "Ubuntu Bionic Beaver 18.04",
});
const sr = xenorchestra.getXoaStorageRepository({
    nameLabel: "Your storage repository label",
});
const eth0 = xenorchestra.getXoaPif({
    device: "eth0",
    vlan: -1,
});
const user = xenorchestra.getXoaUser({
    username: "test_user",
});
const rs = new xenorchestra.ResourceSet("rs", {
    name: "new-resource-set",
    subjects: [user.then(user => user.id)],
    objects: [
        template.then(template => template.id),
        sr.then(sr => sr.id),
        eth0.then(eth0 => eth0.network),
    ],
    limits: [
        {
            type: "cpus",
            quantity: 20,
        },
        {
            type: "disk",
            quantity: 107374182400,
        },
        {
            type: "memory",
            quantity: 12884901888,
        },
    ],
});
Copy
import pulumi
import pulumi_xenorchestra as xenorchestra

template = xenorchestra.get_xoa_template(name_label="Ubuntu Bionic Beaver 18.04")
sr = xenorchestra.get_xoa_storage_repository(name_label="Your storage repository label")
eth0 = xenorchestra.get_xoa_pif(device="eth0",
    vlan=-1)
user = xenorchestra.get_xoa_user(username="test_user")
rs = xenorchestra.ResourceSet("rs",
    name="new-resource-set",
    subjects=[user.id],
    objects=[
        template.id,
        sr.id,
        eth0.network,
    ],
    limits=[
        {
            "type": "cpus",
            "quantity": 20,
        },
        {
            "type": "disk",
            "quantity": 107374182400,
        },
        {
            "type": "memory",
            "quantity": 12884901888,
        },
    ])
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/vatesfr/pulumi-xenorchestra/sdk/go/xenorchestra"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		template, err := xenorchestra.GetXoaTemplate(ctx, &xenorchestra.GetXoaTemplateArgs{
			NameLabel: "Ubuntu Bionic Beaver 18.04",
		}, nil)
		if err != nil {
			return err
		}
		sr, err := xenorchestra.GetXoaStorageRepository(ctx, &xenorchestra.GetXoaStorageRepositoryArgs{
			NameLabel: "Your storage repository label",
		}, nil)
		if err != nil {
			return err
		}
		eth0, err := xenorchestra.GetXoaPif(ctx, &xenorchestra.GetXoaPifArgs{
			Device: "eth0",
			Vlan:   -1,
		}, nil)
		if err != nil {
			return err
		}
		user, err := xenorchestra.GetXoaUser(ctx, &xenorchestra.GetXoaUserArgs{
			Username: "test_user",
		}, nil)
		if err != nil {
			return err
		}
		_, err = xenorchestra.NewResourceSet(ctx, "rs", &xenorchestra.ResourceSetArgs{
			Name: pulumi.String("new-resource-set"),
			Subjects: pulumi.StringArray{
				pulumi.String(user.Id),
			},
			Objects: pulumi.StringArray{
				pulumi.String(template.Id),
				pulumi.String(sr.Id),
				pulumi.String(eth0.Network),
			},
			Limits: xenorchestra.ResourceSetLimitArray{
				&xenorchestra.ResourceSetLimitArgs{
					Type:     pulumi.String("cpus"),
					Quantity: pulumi.Int(20),
				},
				&xenorchestra.ResourceSetLimitArgs{
					Type:     pulumi.String("disk"),
					Quantity: pulumi.Int(107374182400),
				},
				&xenorchestra.ResourceSetLimitArgs{
					Type:     pulumi.String("memory"),
					Quantity: pulumi.Int(12884901888),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Xenorchestra = Pulumi.Xenorchestra;

return await Deployment.RunAsync(() => 
{
    var template = Xenorchestra.GetXoaTemplate.Invoke(new()
    {
        NameLabel = "Ubuntu Bionic Beaver 18.04",
    });

    var sr = Xenorchestra.GetXoaStorageRepository.Invoke(new()
    {
        NameLabel = "Your storage repository label",
    });

    var eth0 = Xenorchestra.GetXoaPif.Invoke(new()
    {
        Device = "eth0",
        Vlan = -1,
    });

    var user = Xenorchestra.GetXoaUser.Invoke(new()
    {
        Username = "test_user",
    });

    var rs = new Xenorchestra.ResourceSet("rs", new()
    {
        Name = "new-resource-set",
        Subjects = new[]
        {
            user.Apply(getXoaUserResult => getXoaUserResult.Id),
        },
        Objects = new[]
        {
            template.Apply(getXoaTemplateResult => getXoaTemplateResult.Id),
            sr.Apply(getXoaStorageRepositoryResult => getXoaStorageRepositoryResult.Id),
            eth0.Apply(getXoaPifResult => getXoaPifResult.Network),
        },
        Limits = new[]
        {
            new Xenorchestra.Inputs.ResourceSetLimitArgs
            {
                Type = "cpus",
                Quantity = 20,
            },
            new Xenorchestra.Inputs.ResourceSetLimitArgs
            {
                Type = "disk",
                Quantity = 107374182400,
            },
            new Xenorchestra.Inputs.ResourceSetLimitArgs
            {
                Type = "memory",
                Quantity = 12884901888,
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.xenorchestra.XenorchestraFunctions;
import com.pulumi.xenorchestra.inputs.GetXoaTemplateArgs;
import com.pulumi.xenorchestra.inputs.GetXoaStorageRepositoryArgs;
import com.pulumi.xenorchestra.inputs.GetXoaPifArgs;
import com.pulumi.xenorchestra.inputs.GetXoaUserArgs;
import com.pulumi.xenorchestra.ResourceSet;
import com.pulumi.xenorchestra.ResourceSetArgs;
import com.pulumi.xenorchestra.inputs.ResourceSetLimitArgs;
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 template = XenorchestraFunctions.getXoaTemplate(GetXoaTemplateArgs.builder()
            .nameLabel("Ubuntu Bionic Beaver 18.04")
            .build());

        final var sr = XenorchestraFunctions.getXoaStorageRepository(GetXoaStorageRepositoryArgs.builder()
            .nameLabel("Your storage repository label")
            .build());

        final var eth0 = XenorchestraFunctions.getXoaPif(GetXoaPifArgs.builder()
            .device("eth0")
            .vlan(-1)
            .build());

        final var user = XenorchestraFunctions.getXoaUser(GetXoaUserArgs.builder()
            .username("test_user")
            .build());

        var rs = new ResourceSet("rs", ResourceSetArgs.builder()
            .name("new-resource-set")
            .subjects(user.applyValue(getXoaUserResult -> getXoaUserResult.id()))
            .objects(            
                template.applyValue(getXoaTemplateResult -> getXoaTemplateResult.id()),
                sr.applyValue(getXoaStorageRepositoryResult -> getXoaStorageRepositoryResult.id()),
                eth0.applyValue(getXoaPifResult -> getXoaPifResult.network()))
            .limits(            
                ResourceSetLimitArgs.builder()
                    .type("cpus")
                    .quantity(20)
                    .build(),
                ResourceSetLimitArgs.builder()
                    .type("disk")
                    .quantity(107374182400)
                    .build(),
                ResourceSetLimitArgs.builder()
                    .type("memory")
                    .quantity(12884901888)
                    .build())
            .build());

    }
}
Copy
resources:
  rs:
    type: xenorchestra:ResourceSet
    properties:
      name: new-resource-set
      subjects:
        - ${user.id}
      objects:
        - ${template.id}
        - ${sr.id}
        - ${eth0.network}
      limits:
        - type: cpus
          quantity: 20
        - type: disk
          quantity: 1.073741824e+11
        - type: memory
          quantity: 1.2884901888e+10
variables:
  template:
    fn::invoke:
      function: xenorchestra:getXoaTemplate
      arguments:
        nameLabel: Ubuntu Bionic Beaver 18.04
  sr:
    fn::invoke:
      function: xenorchestra:getXoaStorageRepository
      arguments:
        nameLabel: Your storage repository label
  eth0:
    fn::invoke:
      function: xenorchestra:getXoaPif
      arguments:
        device: eth0
        vlan: -1
  user:
    fn::invoke:
      function: xenorchestra:getXoaUser
      arguments:
        username: test_user
Copy

Create ResourceSet Resource

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

Constructor syntax

new ResourceSet(name: string, args: ResourceSetArgs, opts?: CustomResourceOptions);
@overload
def ResourceSet(resource_name: str,
                args: ResourceSetArgs,
                opts: Optional[ResourceOptions] = None)

@overload
def ResourceSet(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                limits: Optional[Sequence[ResourceSetLimitArgs]] = None,
                name: Optional[str] = None,
                objects: Optional[Sequence[str]] = None,
                subjects: Optional[Sequence[str]] = None)
func NewResourceSet(ctx *Context, name string, args ResourceSetArgs, opts ...ResourceOption) (*ResourceSet, error)
public ResourceSet(string name, ResourceSetArgs args, CustomResourceOptions? opts = null)
public ResourceSet(String name, ResourceSetArgs args)
public ResourceSet(String name, ResourceSetArgs args, CustomResourceOptions options)
type: xenorchestra:ResourceSet
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ResourceSetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ResourceSetArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ResourceSetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ResourceSetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ResourceSetArgs
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 resourceSetResource = new Xenorchestra.ResourceSet("resourceSetResource", new()
{
    Limits = new[]
    {
        new Xenorchestra.Inputs.ResourceSetLimitArgs
        {
            Quantity = 0,
            Type = "string",
        },
    },
    Name = "string",
    Objects = new[]
    {
        "string",
    },
    Subjects = new[]
    {
        "string",
    },
});
Copy
example, err := xenorchestra.NewResourceSet(ctx, "resourceSetResource", &xenorchestra.ResourceSetArgs{
	Limits: xenorchestra.ResourceSetLimitArray{
		&xenorchestra.ResourceSetLimitArgs{
			Quantity: pulumi.Int(0),
			Type:     pulumi.String("string"),
		},
	},
	Name: pulumi.String("string"),
	Objects: pulumi.StringArray{
		pulumi.String("string"),
	},
	Subjects: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var resourceSetResource = new ResourceSet("resourceSetResource", ResourceSetArgs.builder()
    .limits(ResourceSetLimitArgs.builder()
        .quantity(0)
        .type("string")
        .build())
    .name("string")
    .objects("string")
    .subjects("string")
    .build());
Copy
resource_set_resource = xenorchestra.ResourceSet("resourceSetResource",
    limits=[{
        "quantity": 0,
        "type": "string",
    }],
    name="string",
    objects=["string"],
    subjects=["string"])
Copy
const resourceSetResource = new xenorchestra.ResourceSet("resourceSetResource", {
    limits: [{
        quantity: 0,
        type: "string",
    }],
    name: "string",
    objects: ["string"],
    subjects: ["string"],
});
Copy
type: xenorchestra:ResourceSet
properties:
    limits:
        - quantity: 0
          type: string
    name: string
    objects:
        - string
    subjects:
        - string
Copy

ResourceSet 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 ResourceSet resource accepts the following input properties:

Limits This property is required. List<ResourceSetLimit>
The limit applied to the resource set.
Name string
The name of the resource set.
Objects List<string>
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
Subjects List<string>
The uuids of the user accounts that should have access to the resource set.
Limits This property is required. []ResourceSetLimitArgs
The limit applied to the resource set.
Name string
The name of the resource set.
Objects []string
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
Subjects []string
The uuids of the user accounts that should have access to the resource set.
limits This property is required. List<ResourceSetLimit>
The limit applied to the resource set.
name String
The name of the resource set.
objects List<String>
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
subjects List<String>
The uuids of the user accounts that should have access to the resource set.
limits This property is required. ResourceSetLimit[]
The limit applied to the resource set.
name string
The name of the resource set.
objects string[]
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
subjects string[]
The uuids of the user accounts that should have access to the resource set.
limits This property is required. Sequence[ResourceSetLimitArgs]
The limit applied to the resource set.
name str
The name of the resource set.
objects Sequence[str]
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
subjects Sequence[str]
The uuids of the user accounts that should have access to the resource set.
limits This property is required. List<Property Map>
The limit applied to the resource set.
name String
The name of the resource set.
objects List<String>
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
subjects List<String>
The uuids of the user accounts that should have access to the resource set.

Outputs

All input properties are implicitly available as output properties. Additionally, the ResourceSet 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 ResourceSet Resource

Get an existing ResourceSet 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?: ResourceSetState, opts?: CustomResourceOptions): ResourceSet
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        limits: Optional[Sequence[ResourceSetLimitArgs]] = None,
        name: Optional[str] = None,
        objects: Optional[Sequence[str]] = None,
        subjects: Optional[Sequence[str]] = None) -> ResourceSet
func GetResourceSet(ctx *Context, name string, id IDInput, state *ResourceSetState, opts ...ResourceOption) (*ResourceSet, error)
public static ResourceSet Get(string name, Input<string> id, ResourceSetState? state, CustomResourceOptions? opts = null)
public static ResourceSet get(String name, Output<String> id, ResourceSetState state, CustomResourceOptions options)
resources:  _:    type: xenorchestra:ResourceSet    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Limits List<ResourceSetLimit>
The limit applied to the resource set.
Name string
The name of the resource set.
Objects List<string>
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
Subjects List<string>
The uuids of the user accounts that should have access to the resource set.
Limits []ResourceSetLimitArgs
The limit applied to the resource set.
Name string
The name of the resource set.
Objects []string
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
Subjects []string
The uuids of the user accounts that should have access to the resource set.
limits List<ResourceSetLimit>
The limit applied to the resource set.
name String
The name of the resource set.
objects List<String>
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
subjects List<String>
The uuids of the user accounts that should have access to the resource set.
limits ResourceSetLimit[]
The limit applied to the resource set.
name string
The name of the resource set.
objects string[]
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
subjects string[]
The uuids of the user accounts that should have access to the resource set.
limits Sequence[ResourceSetLimitArgs]
The limit applied to the resource set.
name str
The name of the resource set.
objects Sequence[str]
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
subjects Sequence[str]
The uuids of the user accounts that should have access to the resource set.
limits List<Property Map>
The limit applied to the resource set.
name String
The name of the resource set.
objects List<String>
The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
subjects List<String>
The uuids of the user accounts that should have access to the resource set.

Supporting Types

ResourceSetLimit
, ResourceSetLimitArgs

Quantity This property is required. int
The numerical limit for the given type.
Type This property is required. string
The type of resource set limit. Must be cpus, memory or disk.
Quantity This property is required. int
The numerical limit for the given type.
Type This property is required. string
The type of resource set limit. Must be cpus, memory or disk.
quantity This property is required. Integer
The numerical limit for the given type.
type This property is required. String
The type of resource set limit. Must be cpus, memory or disk.
quantity This property is required. number
The numerical limit for the given type.
type This property is required. string
The type of resource set limit. Must be cpus, memory or disk.
quantity This property is required. int
The numerical limit for the given type.
type This property is required. str
The type of resource set limit. Must be cpus, memory or disk.
quantity This property is required. Number
The numerical limit for the given type.
type This property is required. String
The type of resource set limit. Must be cpus, memory or disk.

Import

ID can be found from the following command:

$ xo-cli resourceSet.getAll

$ pulumi import xenorchestra:index/resourceSet:ResourceSet rs MGSpuwnbtUE
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
xenorchestra vatesfr/pulumi-xenorchestra
License
Apache-2.0
Notes
This Pulumi package is based on the xenorchestra Terraform Provider.