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

xenorchestra.getNetwork

Explore with Pulumi AI

xenorchestra v1.5.2 published on Monday, Mar 10, 2025 by Vates
Deprecated: xenorchestra.index/getnetwork.getNetwork has been deprecated in favor of xenorchestra.index/getxoanetwork.getXoaNetwork

Example Usage

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

const net = xenorchestra.getXoaNetwork({
    nameLabel: "Pool-wide network associated with eth0",
});
const demo_vm = new xenorchestra.Vm("demo-vm", {networks: [{
    networkId: net.then(net => net.id),
}]});
Copy
import pulumi
import pulumi_xenorchestra as xenorchestra

net = xenorchestra.get_xoa_network(name_label="Pool-wide network associated with eth0")
demo_vm = xenorchestra.Vm("demo-vm", networks=[{
    "network_id": net.id,
}])
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 {
		net, err := xenorchestra.LookupXoaNetwork(ctx, &xenorchestra.LookupXoaNetworkArgs{
			NameLabel: "Pool-wide network associated with eth0",
		}, nil)
		if err != nil {
			return err
		}
		_, err = xenorchestra.NewVm(ctx, "demo-vm", &xenorchestra.VmArgs{
			Networks: xenorchestra.VmNetworkArray{
				&xenorchestra.VmNetworkArgs{
					NetworkId: pulumi.String(net.Id),
				},
			},
		})
		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 net = Xenorchestra.GetXoaNetwork.Invoke(new()
    {
        NameLabel = "Pool-wide network associated with eth0",
    });

    var demo_vm = new Xenorchestra.Vm("demo-vm", new()
    {
        Networks = new[]
        {
            new Xenorchestra.Inputs.VmNetworkArgs
            {
                NetworkId = net.Apply(getXoaNetworkResult => getXoaNetworkResult.Id),
            },
        },
    });

});
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.GetXoaNetworkArgs;
import com.pulumi.xenorchestra.Vm;
import com.pulumi.xenorchestra.VmArgs;
import com.pulumi.xenorchestra.inputs.VmNetworkArgs;
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 net = XenorchestraFunctions.getXoaNetwork(GetXoaNetworkArgs.builder()
            .nameLabel("Pool-wide network associated with eth0")
            .build());

        var demo_vm = new Vm("demo-vm", VmArgs.builder()
            .networks(VmNetworkArgs.builder()
                .networkId(net.applyValue(getXoaNetworkResult -> getXoaNetworkResult.id()))
                .build())
            .build());

    }
}
Copy
resources:
  demo-vm:
    type: xenorchestra:Vm
    properties:
      networks:
        - networkId: ${net.id}
variables:
  net:
    fn::invoke:
      function: xenorchestra:getXoaNetwork
      arguments:
        nameLabel: Pool-wide network associated with eth0
Copy

Using getNetwork

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 getNetwork(args: GetNetworkArgs, opts?: InvokeOptions): Promise<GetNetworkResult>
function getNetworkOutput(args: GetNetworkOutputArgs, opts?: InvokeOptions): Output<GetNetworkResult>
Copy
def get_network(bridge: Optional[str] = None,
                name_label: Optional[str] = None,
                pool_id: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetNetworkResult
def get_network_output(bridge: Optional[pulumi.Input[str]] = None,
                name_label: Optional[pulumi.Input[str]] = None,
                pool_id: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetNetworkResult]
Copy
func LookupNetwork(ctx *Context, args *LookupNetworkArgs, opts ...InvokeOption) (*LookupNetworkResult, error)
func LookupNetworkOutput(ctx *Context, args *LookupNetworkOutputArgs, opts ...InvokeOption) LookupNetworkResultOutput
Copy

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

public static class GetNetwork 
{
    public static Task<GetNetworkResult> InvokeAsync(GetNetworkArgs args, InvokeOptions? opts = null)
    public static Output<GetNetworkResult> Invoke(GetNetworkInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetNetworkResult> getNetwork(GetNetworkArgs args, InvokeOptions options)
public static Output<GetNetworkResult> getNetwork(GetNetworkArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: xenorchestra:index/getNetwork:getNetwork
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

NameLabel This property is required. string
The name of the network.
Bridge string
The name of the bridge network interface.
PoolId string
The pool the network is associated with.
NameLabel This property is required. string
The name of the network.
Bridge string
The name of the bridge network interface.
PoolId string
The pool the network is associated with.
nameLabel This property is required. String
The name of the network.
bridge String
The name of the bridge network interface.
poolId String
The pool the network is associated with.
nameLabel This property is required. string
The name of the network.
bridge string
The name of the bridge network interface.
poolId string
The pool the network is associated with.
name_label This property is required. str
The name of the network.
bridge str
The name of the bridge network interface.
pool_id str
The pool the network is associated with.
nameLabel This property is required. String
The name of the network.
bridge String
The name of the bridge network interface.
poolId String
The pool the network is associated with.

getNetwork Result

The following output properties are available:

Bridge string
The name of the bridge network interface.
Id string
The provider-assigned unique ID for this managed resource.
NameLabel string
The name of the network.
PoolId string
The pool the network is associated with.
Bridge string
The name of the bridge network interface.
Id string
The provider-assigned unique ID for this managed resource.
NameLabel string
The name of the network.
PoolId string
The pool the network is associated with.
bridge String
The name of the bridge network interface.
id String
The provider-assigned unique ID for this managed resource.
nameLabel String
The name of the network.
poolId String
The pool the network is associated with.
bridge string
The name of the bridge network interface.
id string
The provider-assigned unique ID for this managed resource.
nameLabel string
The name of the network.
poolId string
The pool the network is associated with.
bridge str
The name of the bridge network interface.
id str
The provider-assigned unique ID for this managed resource.
name_label str
The name of the network.
pool_id str
The pool the network is associated with.
bridge String
The name of the bridge network interface.
id String
The provider-assigned unique ID for this managed resource.
nameLabel String
The name of the network.
poolId String
The pool the network is associated with.

Package Details

Repository
xenorchestra vatesfr/pulumi-xenorchestra
License
Apache-2.0
Notes
This Pulumi package is based on the xenorchestra Terraform Provider.
xenorchestra v1.5.2 published on Monday, Mar 10, 2025 by Vates