Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vatesfr/pulumi-xenorchestra #6852

Merged
merged 3 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions community-packages/package-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@
{
"repoSlug": "UpCloudLtd/pulumi-upcloud",
"schemaFile": "provider/cmd/pulumi-resource-upcloud/schema.json"
},
{
"repoSlug": "vatesfr/pulumi-xenorchestra",
"schemaFile": "provider/cmd/pulumi-resource-xenorchestra/schema.json"
}
]
}
268 changes: 268 additions & 0 deletions themes/default/content/registry/packages/xenorchestra/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
---
# WARNING: this file was fetched from https://raw.githubusercontent.com/vatesfr/pulumi-xenorchestra/v1.5.2/docs/_index.md
# Do not edit by hand unless you're certain you know what you are doing!
title: Xen Orchestra
meta_desc: Provides an overview of the Xen Orchestra Provider for Pulumi.
layout: package
---

The Xen Orchestra Provider lets you manage [Xen Orchestra](https://github.com/vatesfr/xen-orchestra) resources.

## Information

Note that the Xen Orchestra Pulumi provider is a based on the [Terraform Xen Orchestra Provider](https://github.com/vatesfr/terraform-provider-xenorchestra)

# Examples

Those examples uses `pulumi config set xenorchestra:token --secret` and `pulumi config set xenorchestra:url <url>` to configure the provider.

{{< chooser language "python,go,typescript,csharp,yaml" >}}
{{% choosable language python %}}

```python
import pulumi
import pulumi_xenorchestra as xoa
import pathlib

template = xoa.get_xoa_template(
name_label="Debian 12 Cloud-init (Hub)",
pool_id=pool.id
)

xoa.Vm(
resource_name="Pulumi example",
name_label="Pulumi example",
name_description="Example with pulumi python provider",
tags=["pulumi"],
cpus=1,
memory_max=1073733632,
template=template.id,
cloud_config=pathlib.Path("./config/cloudinit-xen-static.yaml").read_text(),
disks=[
xoa.VmDiskArgs(
name_label="OS",
size=4294967296,
sr_id="sr-id"
),
],
networks=[
xoa.VmNetworkArgs(
network_id="network-id",
),
],
power_state="Running",
)

pulumi.export("vm_ip", vm.ipv4_addresses)
```

{{% /choosable %}}

{{% choosable language go %}}

```go
package main

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

func main() {
pulumi.Run(func(ctx *pulumi.Context) error {

poolId := "pool-id"

template, err := xoa.GetXoaTemplate(ctx, &xoa.GetXoaTemplateArgs{
NameLabel: "Debian 12 Cloud-init (Hub)",
PoolId: &poolId,
})
if err != nil {
return err
}

vm, err := xoa.NewVm(ctx, "Pulumi example", &xoa.VmArgs{
NameLabel: pulumi.String("Pulumi example"),
NameDescription: pulumi.String("Example with pulumi golang provider"),
Tags: pulumi.StringArray{pulumi.String("pulumi")},
Cpus: pulumi.Int(1),
MemoryMax: pulumi.Float64(1073733632),
Template: pulumi.String(template.Id),
CloudConfig: pulumi.String(`
#cloud-config
ssh_authorized_keys:
- ....
`),
Disks: xoa.VmDiskArray{
xoa.VmDiskArgs{
NameLabel: pulumi.String("OS"),
Size: pulumi.Float64(4294967296),
SrId: pulumi.String("sr-id"),
},
},
Networks: xoa.VmNetworkArray{
xoa.VmNetworkArgs{
NetworkId: pulumi.String(net.Id),
},
},
PowerState: pulumi.String("Running"),
})
if err != nil {
return err
}

ctx.Export("vp_ip", vm.Ipv4Addresses)
return nil
})
}

```

{{% /choosable %}}

{{% choosable language typescript %}}

```typescript
import * as pulumi from "@pulumi/pulumi";
import * as xoa from "@pulumi/xenorchestra"

async function getPrerequisites(){
const template = await xoa.getXoaTemplate({
nameLabel: "Debian 12 Cloud-init (Hub)",
poolId: "pool-id"
})

return {
template: template
}
}

export const out = getPrerequisites().then(prerequisites => {
const vm = new xoa.Vm("Pulumi example", {
nameLabel: "Pulumi example",
nameDescription: "Example with pulumi typescript provider",
tags: ["pulumi"],
cpus: 1,
memoryMax: 1073733632,
template: prerequisites.template.id,
cloudConfig: `
#cloud-config
ssh_authorized_keys:
- ...
`,
disks: [
{
nameLabel: "OS",
size: 4294967296,
srId: "sr-id",
}
],
networks: [
{
networkId: "network-id",
}
],
powerState: "Running"
})
return vm.ipv4Addresses
})
```

{{% /choosable %}}

{{% choosable language csharp %}}

```csharp
using System.Collections.Generic;
using Pulumi;
using Pulumi.Xenorchestra;
using Pulumi.Xenorchestra.Inputs;

return await Deployment.RunAsync(() =>
{
var template = GetXoaTemplate.Invoke(new GetXoaTemplateInvokeArgs
{
NameLabel = "Debian 12 Cloud-init (Hub)",
PoolId = "pool-id"
});
var vm = new Vm("vm", new VmArgs
{
NameLabel = "Pulumi example",
NameDescription = "Example with pulumi dotnet provider",
Tags = ["pulumi"],
Cpus = 1,
MemoryMax = 1073733632,
Template = template.Apply(getXoaTemplateResult => getXoaTemplateResult.Id),
CloudConfig = """
#cloud-config
ssh_authorized_keys:
- ...
"""
Disks = new VmDiskArgs[] {
new VmDiskArgs {
NameLabel = "OS",
Size = 4294967296,
SrId = "sr-id"
}
},
Networks = new VmNetworkArgs[] {
new VmNetworkArgs {
NetworkId = "network-id"
}
},
PowerState = "Running"
});

return new Dictionary<string, object?>
{
["vp_ip"] = vm.Ipv4Addresses.Apply(ipv4Addresses => ipv4Addresses)
};
});
```
{{% /choosable %}}

{{% choosable language yaml %}}

```yaml
name: test-yaml
description: A minimal Pulumi YAML program
runtime: yaml
config: {'pulumi:tags': {value: {'pulumi:template': yaml}}}
variables:
templateId:
fn::invoke:
function: xenorchestra:getXoaTemplate
arguments:
nameLabel: "Debian 12 Cloud-init (Hub)"
poolId: "pool-id"
return: id
resources:
vm:
type: xenorchestra:Vm
properties:
nameLabel: "Pulumi example"
nameDescription: "Example with pulumi yam provider"
tags:
- pulumi
cpus: 1
memoryMax: 1073733632
template: ${templateId}
cloudConfig: |
#cloud-config
ssh_authorized_keys:
- ...
disks:
- nameLabel: "OS"
size: 4294967296
srId: "sr-id"
networks:
- networkId: "network-id"
powerState: "Running"

outputs:
vmIp: ${vm.ipv4Addresses}
```

{{% /choosable %}}

{{< /chooser >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
# WARNING: this file was fetched from https://raw.githubusercontent.com/vatesfr/pulumi-xenorchestra/v1.5.2/docs/installation-configuration.md
# Do not edit by hand unless you're certain you know what you are doing!
title: Xenorchestra Installation & Configuration
meta_desc: Information on how to install the Xenorchestra provider.
layout: package
---

## Installation

The Pulumi `Xenorchestra` provider is available as a package in all Pulumi languages:

* JavaScript/TypeScript: [`@vates/pulumi-xenorchestra`](https://www.npmjs.com/package/@vates/pulumi-xenorchestra)
* Python: [`pulumi-xenorchestra`](https://pypi.org/project/pulumi-xenorchestra/)
* Go: [`github.com/vatesfr/pulumi-xenorchestra/sdk`](https://pkg.go.dev/github.com/vatesfr/pulumi-xenorchestra/sdk)
* .NET: [`Pulumi.Xenorchestra`](https://www.nuget.org/packages/Pulumi.Xenorchestra)

### Provider Binary

The Xenorchestra provider binary is a third party binary. It can be installed using the `pulumi plugin` command.

```bash
pulumi plugin install resource xenorchestra vX.Y.Z --server github://api.github.com/vatesfr/pulumi-xenorchestra
```

Replace the version string with your desired version.

## Setup

To provision resources with the Pulumi Xenorchestra provider, you need to have Xenorchestra credentials.
Your Xenorchestra credentials are never sent to pulumi.com. Pulumi uses the Xenorchestra API and the credentials in your environment to authenticate requests from your computer to your Xenorchestra instance.

### Get your credentials

Use `pulumi config set xenorchestra:<option>` (see [documentation](https://www.pulumi.com/docs/concepts/config/) or pass options to the constructor of new xenorchestra.Provider or use environment variables.

The following configuration points are available for the `xenorchestra` provider:

- `xenorchestra:url` (environment: `XOA_URL`) - the URL for the Xen Orchestra websockets endpoint. Starts with `wss://`
Set either:
- `xenorchestra:username` (environment: `XOA_USERNAME`) - the username for Xen Orchestra
- `xenorchestra:password` (environment: `XOA_PASSWORD`) - the password for Xen Orchestra
Or:
- `xenorchestra:token` (environment: `XOA_TOKEN`) - API token for Xen Orchestra

- `xenorchestra:insecure` (environment: `XOA_INSECURE`) - set to any value to disable SSL verification, false by default. Only use if you are using a self-signed certificate and know what you are doing.


To get a token you can use the [xo-cli](https://docs.xen-orchestra.com/architecture#xo-cli-cli) or the XO GUI (under User > Authentication tokens).

16 changes: 16 additions & 0 deletions themes/default/data/registry/packages/xenorchestra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# WARNING: this file was generated by resourcedocsgen
# Do not edit by hand unless you're certain you know what you are doing!
category: Cloud
component: false
description: A Pulumi package for creating and managing Xen Orchestra cloud resources.
featured: false
logo_url: https://raw.githubusercontent.com/vatesfr/pulumi-xenorchestra/8c71624229d953d4fb7d4843d5483e53e21b9459/logo_xo.png
name: xenorchestra
native: false
package_status: ga
publisher: Vates
repo_url: https://github.com/vatesfr/pulumi-xenorchestra
schema_file_url: https://raw.githubusercontent.com/vatesfr/pulumi-xenorchestra/v1.5.2/provider/cmd/pulumi-resource-xenorchestra/schema.json
title: xenorchestra
updated_on: 1741616780
version: v1.5.2
Loading