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

xenorchestra.Network

Explore with Pulumi AI

Deprecated: xenorchestra.index/network.Network has been deprecated in favor of xenorchestra.index/xoanetwork.XoaNetwork

Example Usage

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

const host1 = xenorchestra.getXoaHost({
    nameLabel: "Your host",
});
// Create a single server network private network
const privateNetwork = new xenorchestra.XoaNetwork("private_network", {
    nameLabel: "new network name",
    poolId: host1.then(host1 => host1.poolId),
});
// Create a network with a 22 VLAN tag from the eth0 device
const vlanNetwork = new xenorchestra.XoaNetwork("vlan_network", {
    nameLabel: "new network name",
    poolId: host1.then(host1 => host1.poolId),
    sourcePifDevice: "eth0",
    vlan: 22,
});
Copy
import pulumi
import pulumi_xenorchestra as xenorchestra

host1 = xenorchestra.get_xoa_host(name_label="Your host")
# Create a single server network private network
private_network = xenorchestra.XoaNetwork("private_network",
    name_label="new network name",
    pool_id=host1.pool_id)
# Create a network with a 22 VLAN tag from the eth0 device
vlan_network = xenorchestra.XoaNetwork("vlan_network",
    name_label="new network name",
    pool_id=host1.pool_id,
    source_pif_device="eth0",
    vlan=22)
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 {
		host1, err := xenorchestra.GetXoaHost(ctx, &xenorchestra.GetXoaHostArgs{
			NameLabel: "Your host",
		}, nil)
		if err != nil {
			return err
		}
		// Create a single server network private network
		_, err = xenorchestra.NewXoaNetwork(ctx, "private_network", &xenorchestra.XoaNetworkArgs{
			NameLabel: pulumi.String("new network name"),
			PoolId:    pulumi.String(host1.PoolId),
		})
		if err != nil {
			return err
		}
		// Create a network with a 22 VLAN tag from the eth0 device
		_, err = xenorchestra.NewXoaNetwork(ctx, "vlan_network", &xenorchestra.XoaNetworkArgs{
			NameLabel:       pulumi.String("new network name"),
			PoolId:          pulumi.String(host1.PoolId),
			SourcePifDevice: pulumi.String("eth0"),
			Vlan:            pulumi.Int(22),
		})
		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 host1 = Xenorchestra.GetXoaHost.Invoke(new()
    {
        NameLabel = "Your host",
    });

    // Create a single server network private network
    var privateNetwork = new Xenorchestra.XoaNetwork("private_network", new()
    {
        NameLabel = "new network name",
        PoolId = host1.Apply(getXoaHostResult => getXoaHostResult.PoolId),
    });

    // Create a network with a 22 VLAN tag from the eth0 device
    var vlanNetwork = new Xenorchestra.XoaNetwork("vlan_network", new()
    {
        NameLabel = "new network name",
        PoolId = host1.Apply(getXoaHostResult => getXoaHostResult.PoolId),
        SourcePifDevice = "eth0",
        Vlan = 22,
    });

});
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.GetXoaHostArgs;
import com.pulumi.xenorchestra.XoaNetwork;
import com.pulumi.xenorchestra.XoaNetworkArgs;
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 host1 = XenorchestraFunctions.getXoaHost(GetXoaHostArgs.builder()
            .nameLabel("Your host")
            .build());

        // Create a single server network private network
        var privateNetwork = new XoaNetwork("privateNetwork", XoaNetworkArgs.builder()
            .nameLabel("new network name")
            .poolId(host1.applyValue(getXoaHostResult -> getXoaHostResult.poolId()))
            .build());

        // Create a network with a 22 VLAN tag from the eth0 device
        var vlanNetwork = new XoaNetwork("vlanNetwork", XoaNetworkArgs.builder()
            .nameLabel("new network name")
            .poolId(host1.applyValue(getXoaHostResult -> getXoaHostResult.poolId()))
            .sourcePifDevice("eth0")
            .vlan(22)
            .build());

    }
}
Copy
resources:
  # Create a single server network private network
  privateNetwork:
    type: xenorchestra:XoaNetwork
    name: private_network
    properties:
      nameLabel: new network name
      poolId: ${host1.poolId}
  # Create a network with a 22 VLAN tag from the eth0 device
  vlanNetwork:
    type: xenorchestra:XoaNetwork
    name: vlan_network
    properties:
      nameLabel: new network name
      poolId: ${host1.poolId}
      sourcePifDevice: eth0
      vlan: 22
variables:
  host1:
    fn::invoke:
      function: xenorchestra:getXoaHost
      arguments:
        nameLabel: Your host
Copy

Create Network Resource

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

Constructor syntax

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

@overload
def Network(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            automatic: Optional[bool] = None,
            default_is_locked: Optional[bool] = None,
            mtu: Optional[int] = None,
            name_description: Optional[str] = None,
            name_label: Optional[str] = None,
            nbd: Optional[bool] = None,
            pool_id: Optional[str] = None,
            source_pif_device: Optional[str] = None,
            vlan: Optional[int] = None)
func NewNetwork(ctx *Context, name string, args NetworkArgs, opts ...ResourceOption) (*Network, error)
public Network(string name, NetworkArgs args, CustomResourceOptions? opts = null)
public Network(String name, NetworkArgs args)
public Network(String name, NetworkArgs args, CustomResourceOptions options)
type: xenorchestra:Network
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. NetworkArgs
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. NetworkArgs
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. NetworkArgs
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. NetworkArgs
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. NetworkArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

NameLabel This property is required. string
The name label of the network.
PoolId
This property is required.
Changes to this property will trigger replacement.
string
The pool id that this network should belong to.
Automatic bool
DefaultIsLocked bool
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
Mtu Changes to this property will trigger replacement. int
The MTU of the network. Defaults to 1500 if unspecified.
NameDescription string
Nbd bool
Whether the network should use a network block device. Defaults to false if unspecified.
SourcePifDevice Changes to this property will trigger replacement. string
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
Vlan Changes to this property will trigger replacement. int
The vlan to use for the network. Defaults to 0 meaning no VLAN.
NameLabel This property is required. string
The name label of the network.
PoolId
This property is required.
Changes to this property will trigger replacement.
string
The pool id that this network should belong to.
Automatic bool
DefaultIsLocked bool
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
Mtu Changes to this property will trigger replacement. int
The MTU of the network. Defaults to 1500 if unspecified.
NameDescription string
Nbd bool
Whether the network should use a network block device. Defaults to false if unspecified.
SourcePifDevice Changes to this property will trigger replacement. string
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
Vlan Changes to this property will trigger replacement. int
The vlan to use for the network. Defaults to 0 meaning no VLAN.
nameLabel This property is required. String
The name label of the network.
poolId
This property is required.
Changes to this property will trigger replacement.
String
The pool id that this network should belong to.
automatic Boolean
defaultIsLocked Boolean
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
mtu Changes to this property will trigger replacement. Integer
The MTU of the network. Defaults to 1500 if unspecified.
nameDescription String
nbd Boolean
Whether the network should use a network block device. Defaults to false if unspecified.
sourcePifDevice Changes to this property will trigger replacement. String
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
vlan Changes to this property will trigger replacement. Integer
The vlan to use for the network. Defaults to 0 meaning no VLAN.
nameLabel This property is required. string
The name label of the network.
poolId
This property is required.
Changes to this property will trigger replacement.
string
The pool id that this network should belong to.
automatic boolean
defaultIsLocked boolean
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
mtu Changes to this property will trigger replacement. number
The MTU of the network. Defaults to 1500 if unspecified.
nameDescription string
nbd boolean
Whether the network should use a network block device. Defaults to false if unspecified.
sourcePifDevice Changes to this property will trigger replacement. string
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
vlan Changes to this property will trigger replacement. number
The vlan to use for the network. Defaults to 0 meaning no VLAN.
name_label This property is required. str
The name label of the network.
pool_id
This property is required.
Changes to this property will trigger replacement.
str
The pool id that this network should belong to.
automatic bool
default_is_locked bool
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
mtu Changes to this property will trigger replacement. int
The MTU of the network. Defaults to 1500 if unspecified.
name_description str
nbd bool
Whether the network should use a network block device. Defaults to false if unspecified.
source_pif_device Changes to this property will trigger replacement. str
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
vlan Changes to this property will trigger replacement. int
The vlan to use for the network. Defaults to 0 meaning no VLAN.
nameLabel This property is required. String
The name label of the network.
poolId
This property is required.
Changes to this property will trigger replacement.
String
The pool id that this network should belong to.
automatic Boolean
defaultIsLocked Boolean
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
mtu Changes to this property will trigger replacement. Number
The MTU of the network. Defaults to 1500 if unspecified.
nameDescription String
nbd Boolean
Whether the network should use a network block device. Defaults to false if unspecified.
sourcePifDevice Changes to this property will trigger replacement. String
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
vlan Changes to this property will trigger replacement. Number
The vlan to use for the network. Defaults to 0 meaning no VLAN.

Outputs

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

Get an existing Network 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?: NetworkState, opts?: CustomResourceOptions): Network
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        automatic: Optional[bool] = None,
        default_is_locked: Optional[bool] = None,
        mtu: Optional[int] = None,
        name_description: Optional[str] = None,
        name_label: Optional[str] = None,
        nbd: Optional[bool] = None,
        pool_id: Optional[str] = None,
        source_pif_device: Optional[str] = None,
        vlan: Optional[int] = None) -> Network
func GetNetwork(ctx *Context, name string, id IDInput, state *NetworkState, opts ...ResourceOption) (*Network, error)
public static Network Get(string name, Input<string> id, NetworkState? state, CustomResourceOptions? opts = null)
public static Network get(String name, Output<String> id, NetworkState state, CustomResourceOptions options)
resources:  _:    type: xenorchestra:Network    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:
Automatic bool
DefaultIsLocked bool
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
Mtu Changes to this property will trigger replacement. int
The MTU of the network. Defaults to 1500 if unspecified.
NameDescription string
NameLabel string
The name label of the network.
Nbd bool
Whether the network should use a network block device. Defaults to false if unspecified.
PoolId Changes to this property will trigger replacement. string
The pool id that this network should belong to.
SourcePifDevice Changes to this property will trigger replacement. string
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
Vlan Changes to this property will trigger replacement. int
The vlan to use for the network. Defaults to 0 meaning no VLAN.
Automatic bool
DefaultIsLocked bool
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
Mtu Changes to this property will trigger replacement. int
The MTU of the network. Defaults to 1500 if unspecified.
NameDescription string
NameLabel string
The name label of the network.
Nbd bool
Whether the network should use a network block device. Defaults to false if unspecified.
PoolId Changes to this property will trigger replacement. string
The pool id that this network should belong to.
SourcePifDevice Changes to this property will trigger replacement. string
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
Vlan Changes to this property will trigger replacement. int
The vlan to use for the network. Defaults to 0 meaning no VLAN.
automatic Boolean
defaultIsLocked Boolean
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
mtu Changes to this property will trigger replacement. Integer
The MTU of the network. Defaults to 1500 if unspecified.
nameDescription String
nameLabel String
The name label of the network.
nbd Boolean
Whether the network should use a network block device. Defaults to false if unspecified.
poolId Changes to this property will trigger replacement. String
The pool id that this network should belong to.
sourcePifDevice Changes to this property will trigger replacement. String
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
vlan Changes to this property will trigger replacement. Integer
The vlan to use for the network. Defaults to 0 meaning no VLAN.
automatic boolean
defaultIsLocked boolean
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
mtu Changes to this property will trigger replacement. number
The MTU of the network. Defaults to 1500 if unspecified.
nameDescription string
nameLabel string
The name label of the network.
nbd boolean
Whether the network should use a network block device. Defaults to false if unspecified.
poolId Changes to this property will trigger replacement. string
The pool id that this network should belong to.
sourcePifDevice Changes to this property will trigger replacement. string
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
vlan Changes to this property will trigger replacement. number
The vlan to use for the network. Defaults to 0 meaning no VLAN.
automatic bool
default_is_locked bool
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
mtu Changes to this property will trigger replacement. int
The MTU of the network. Defaults to 1500 if unspecified.
name_description str
name_label str
The name label of the network.
nbd bool
Whether the network should use a network block device. Defaults to false if unspecified.
pool_id Changes to this property will trigger replacement. str
The pool id that this network should belong to.
source_pif_device Changes to this property will trigger replacement. str
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
vlan Changes to this property will trigger replacement. int
The vlan to use for the network. Defaults to 0 meaning no VLAN.
automatic Boolean
defaultIsLocked Boolean
This argument controls whether the network should enforce VIF locking. This defaults to false which means that no filtering rules are applied.
mtu Changes to this property will trigger replacement. Number
The MTU of the network. Defaults to 1500 if unspecified.
nameDescription String
nameLabel String
The name label of the network.
nbd Boolean
Whether the network should use a network block device. Defaults to false if unspecified.
poolId Changes to this property will trigger replacement. String
The pool id that this network should belong to.
sourcePifDevice Changes to this property will trigger replacement. String
The PIF device (eth0, eth1, etc) that will be used as an input during network creation. This parameter is required if a vlan is specified.
vlan Changes to this property will trigger replacement. Number
The vlan to use for the network. Defaults to 0 meaning no VLAN.

Package Details

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