From b3a115a9144e638a4781df3de1a089f831624d32 Mon Sep 17 00:00:00 2001 From: "Cyrille G." Date: Fri, 28 Feb 2025 16:29:41 +0100 Subject: [PATCH 1/2] Add pulumi-xenorchestra community package --- community-packages/package-list.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/community-packages/package-list.json b/community-packages/package-list.json index de682ac38e..dd2a763ff1 100644 --- a/community-packages/package-list.json +++ b/community-packages/package-list.json @@ -375,6 +375,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" } ] } From fcc0d2b710063e4aaa4d136577d0f355feab6222 Mon Sep 17 00:00:00 2001 From: Florian Stadler Date: Thu, 13 Mar 2025 12:14:45 +0100 Subject: [PATCH 2/2] Generate xenorchestra docs for testing --- .../registry/packages/xenorchestra/_index.md | 268 ++++++++++++++++++ .../installation-configuration.md | 50 ++++ .../data/registry/packages/xenorchestra.yaml | 16 ++ 3 files changed, 334 insertions(+) create mode 100644 themes/default/content/registry/packages/xenorchestra/_index.md create mode 100644 themes/default/content/registry/packages/xenorchestra/installation-configuration.md create mode 100644 themes/default/data/registry/packages/xenorchestra.yaml diff --git a/themes/default/content/registry/packages/xenorchestra/_index.md b/themes/default/content/registry/packages/xenorchestra/_index.md new file mode 100644 index 0000000000..652aabbc1c --- /dev/null +++ b/themes/default/content/registry/packages/xenorchestra/_index.md @@ -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 ` 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 + { + ["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 >}} diff --git a/themes/default/content/registry/packages/xenorchestra/installation-configuration.md b/themes/default/content/registry/packages/xenorchestra/installation-configuration.md new file mode 100644 index 0000000000..874d76eeed --- /dev/null +++ b/themes/default/content/registry/packages/xenorchestra/installation-configuration.md @@ -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: