diff --git a/sdk/dotnet/Group.cs b/sdk/dotnet/Group.cs index feba46b..2c6ce5a 100644 --- a/sdk/dotnet/Group.cs +++ b/sdk/dotnet/Group.cs @@ -14,6 +14,30 @@ namespace Pulumiverse.Matchbox /// ## # Group Resource /// /// A Group matches (one or more) machines and declares a machine should be boot with a named `profile`. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Matchbox = Pulumiverse.Matchbox; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var node1 = new Matchbox.Group("node1", new() + /// { + /// Metadata = + /// { + /// { "custom_variable", "machine_specific_value_here" }, + /// }, + /// Profile = matchbox_profile.Myprofile.Name, + /// Selector = + /// { + /// { "mac", "52:54:00:a1:9c:ae" }, + /// }, + /// }); + /// + /// }); + /// ``` /// [MatchboxResourceType("matchbox:index/group:Group")] public partial class Group : global::Pulumi.CustomResource diff --git a/sdk/dotnet/Profile.cs b/sdk/dotnet/Profile.cs index 64713f0..26ff533 100644 --- a/sdk/dotnet/Profile.cs +++ b/sdk/dotnet/Profile.cs @@ -14,6 +14,23 @@ namespace Pulumiverse.Matchbox /// ## # Profile Resource /// /// A Profile defines network boot and declarative provisioning configurations. + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var config = new Config(); + /// var osStream = config.Get("osStream") ?? "stable"; + /// var osVersion = config.Require("osVersion"); + /// var kernel = $"https://builds.coreos.fedoraproject.org/prod/streams/{osStream}/builds/{osVersion}/x86_64/fedora-coreos-{osVersion}-live-kernel-x86_64"; + /// + /// var initrd = $"https://builds.coreos.fedoraproject.org/prod/streams/{osStream}/builds/{osVersion}/x86_64/fedora-coreos-{osVersion}-live-initramfs.x86_64.img"; + /// + /// }); + /// ``` /// [MatchboxResourceType("matchbox:index/profile:Profile")] public partial class Profile : global::Pulumi.CustomResource @@ -30,6 +47,9 @@ public partial class Profile : global::Pulumi.CustomResource [Output("containerLinuxConfig")] public Output ContainerLinuxConfig { get; private set; } = null!; + /// + /// Generic configuration + /// [Output("genericConfig")] public Output GenericConfig { get; private set; } = null!; @@ -119,6 +139,9 @@ public InputList Args [Input("containerLinuxConfig")] public Input? ContainerLinuxConfig { get; set; } + /// + /// Generic configuration + /// [Input("genericConfig")] public Input? GenericConfig { get; set; } @@ -175,6 +198,9 @@ public InputList Args [Input("containerLinuxConfig")] public Input? ContainerLinuxConfig { get; set; } + /// + /// Generic configuration + /// [Input("genericConfig")] public Input? GenericConfig { get; set; } diff --git a/sdk/go/matchbox/group.go b/sdk/go/matchbox/group.go index 275efcb..58e51c8 100644 --- a/sdk/go/matchbox/group.go +++ b/sdk/go/matchbox/group.go @@ -15,6 +15,36 @@ import ( // ## # Group Resource // // A Group matches (one or more) machines and declares a machine should be boot with a named `profile`. +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// "github.com/pulumiverse/pulumi-matchbox/sdk/go/matchbox" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := matchbox.NewGroup(ctx, "node1", &matchbox.GroupArgs{ +// Metadata: pulumi.StringMap{ +// "custom_variable": pulumi.String("machine_specific_value_here"), +// }, +// Profile: pulumi.Any(matchbox_profile.Myprofile.Name), +// Selector: pulumi.StringMap{ +// "mac": pulumi.String("52:54:00:a1:9c:ae"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type Group struct { pulumi.CustomResourceState diff --git a/sdk/go/matchbox/profile.go b/sdk/go/matchbox/profile.go index 7612a6a..4386161 100644 --- a/sdk/go/matchbox/profile.go +++ b/sdk/go/matchbox/profile.go @@ -14,6 +14,34 @@ import ( // ## # Profile Resource // // A Profile defines network boot and declarative provisioning configurations. +// +// ```go +// package main +// +// import ( +// +// "fmt" +// +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// cfg := config.New(ctx, "") +// osStream := "stable" +// if param := cfg.Get("osStream"); param != "" { +// osStream = param +// } +// osVersion := cfg.Require("osVersion") +// _ := fmt.Sprintf("https://builds.coreos.fedoraproject.org/prod/streams/%v/builds/%v/x86_64/fedora-coreos-%v-live-kernel-x86_64", osStream, osVersion, osVersion) +// _ := fmt.Sprintf("https://builds.coreos.fedoraproject.org/prod/streams/%v/builds/%v/x86_64/fedora-coreos-%v-live-initramfs.x86_64.img", osStream, osVersion, osVersion) +// return nil +// }) +// } +// +// ``` type Profile struct { pulumi.CustomResourceState @@ -21,7 +49,8 @@ type Profile struct { Args pulumi.StringArrayOutput `pulumi:"args"` // CoreOS Container Linux Config (CLC) (for backwards compatibility) ContainerLinuxConfig pulumi.StringPtrOutput `pulumi:"containerLinuxConfig"` - GenericConfig pulumi.StringPtrOutput `pulumi:"genericConfig"` + // Generic configuration + GenericConfig pulumi.StringPtrOutput `pulumi:"genericConfig"` // List of URLs to init RAM filesystems Initrds pulumi.StringArrayOutput `pulumi:"initrds"` // URL of the kernel image to boot @@ -65,7 +94,8 @@ type profileState struct { Args []string `pulumi:"args"` // CoreOS Container Linux Config (CLC) (for backwards compatibility) ContainerLinuxConfig *string `pulumi:"containerLinuxConfig"` - GenericConfig *string `pulumi:"genericConfig"` + // Generic configuration + GenericConfig *string `pulumi:"genericConfig"` // List of URLs to init RAM filesystems Initrds []string `pulumi:"initrds"` // URL of the kernel image to boot @@ -80,7 +110,8 @@ type ProfileState struct { Args pulumi.StringArrayInput // CoreOS Container Linux Config (CLC) (for backwards compatibility) ContainerLinuxConfig pulumi.StringPtrInput - GenericConfig pulumi.StringPtrInput + // Generic configuration + GenericConfig pulumi.StringPtrInput // List of URLs to init RAM filesystems Initrds pulumi.StringArrayInput // URL of the kernel image to boot @@ -99,7 +130,8 @@ type profileArgs struct { Args []string `pulumi:"args"` // CoreOS Container Linux Config (CLC) (for backwards compatibility) ContainerLinuxConfig *string `pulumi:"containerLinuxConfig"` - GenericConfig *string `pulumi:"genericConfig"` + // Generic configuration + GenericConfig *string `pulumi:"genericConfig"` // List of URLs to init RAM filesystems Initrds []string `pulumi:"initrds"` // URL of the kernel image to boot @@ -115,7 +147,8 @@ type ProfileArgs struct { Args pulumi.StringArrayInput // CoreOS Container Linux Config (CLC) (for backwards compatibility) ContainerLinuxConfig pulumi.StringPtrInput - GenericConfig pulumi.StringPtrInput + // Generic configuration + GenericConfig pulumi.StringPtrInput // List of URLs to init RAM filesystems Initrds pulumi.StringArrayInput // URL of the kernel image to boot @@ -222,6 +255,7 @@ func (o ProfileOutput) ContainerLinuxConfig() pulumi.StringPtrOutput { return o.ApplyT(func(v *Profile) pulumi.StringPtrOutput { return v.ContainerLinuxConfig }).(pulumi.StringPtrOutput) } +// Generic configuration func (o ProfileOutput) GenericConfig() pulumi.StringPtrOutput { return o.ApplyT(func(v *Profile) pulumi.StringPtrOutput { return v.GenericConfig }).(pulumi.StringPtrOutput) } diff --git a/sdk/nodejs/group.ts b/sdk/nodejs/group.ts index 054d504..20a7cb4 100644 --- a/sdk/nodejs/group.ts +++ b/sdk/nodejs/group.ts @@ -8,6 +8,21 @@ import * as utilities from "./utilities"; * ## # Group Resource * * A Group matches (one or more) machines and declares a machine should be boot with a named `profile`. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as matchbox from "@pulumiverse/matchbox"; + * + * const node1 = new matchbox.Group("node1", { + * metadata: { + * custom_variable: "machine_specific_value_here", + * }, + * profile: matchbox_profile.myprofile.name, + * selector: { + * mac: "52:54:00:a1:9c:ae", + * }, + * }); + * ``` */ export class Group extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/profile.ts b/sdk/nodejs/profile.ts index a87400e..b8b1f0b 100644 --- a/sdk/nodejs/profile.ts +++ b/sdk/nodejs/profile.ts @@ -8,6 +8,16 @@ import * as utilities from "./utilities"; * ## # Profile Resource * * A Profile defines network boot and declarative provisioning configurations. + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * + * const config = new pulumi.Config(); + * const osStream = config.get("osStream") || "stable"; + * const osVersion = config.require("osVersion"); + * const kernel = `https://builds.coreos.fedoraproject.org/prod/streams/${osStream}/builds/${osVersion}/x86_64/fedora-coreos-${osVersion}-live-kernel-x86_64`; + * const initrd = `https://builds.coreos.fedoraproject.org/prod/streams/${osStream}/builds/${osVersion}/x86_64/fedora-coreos-${osVersion}-live-initramfs.x86_64.img`; + * ``` */ export class Profile extends pulumi.CustomResource { /** @@ -45,6 +55,9 @@ export class Profile extends pulumi.CustomResource { * CoreOS Container Linux Config (CLC) (for backwards compatibility) */ public readonly containerLinuxConfig!: pulumi.Output; + /** + * Generic configuration + */ public readonly genericConfig!: pulumi.Output; /** * List of URLs to init RAM filesystems @@ -107,6 +120,9 @@ export interface ProfileState { * CoreOS Container Linux Config (CLC) (for backwards compatibility) */ containerLinuxConfig?: pulumi.Input; + /** + * Generic configuration + */ genericConfig?: pulumi.Input; /** * List of URLs to init RAM filesystems @@ -135,6 +151,9 @@ export interface ProfileArgs { * CoreOS Container Linux Config (CLC) (for backwards compatibility) */ containerLinuxConfig?: pulumi.Input; + /** + * Generic configuration + */ genericConfig?: pulumi.Input; /** * List of URLs to init RAM filesystems diff --git a/sdk/python/pulumiverse_matchbox/_utilities.py b/sdk/python/pulumiverse_matchbox/_utilities.py index e1b3372..955dfdc 100644 --- a/sdk/python/pulumiverse_matchbox/_utilities.py +++ b/sdk/python/pulumiverse_matchbox/_utilities.py @@ -264,7 +264,7 @@ def call_plain( output = pulumi.runtime.call(tok, props, res, typ) # Ingoring deps silently. They are typically non-empty, r.f() calls include r as a dependency. - result, known, secret, _ = _sync_await(asyncio.ensure_future(_await_output(output))) + result, known, secret, _ = _sync_await(asyncio.create_task(_await_output(output))) problem = None if not known: diff --git a/sdk/python/pulumiverse_matchbox/config/__init__.pyi b/sdk/python/pulumiverse_matchbox/config/__init__.pyi index 93e3997..7d18581 100644 --- a/sdk/python/pulumiverse_matchbox/config/__init__.pyi +++ b/sdk/python/pulumiverse_matchbox/config/__init__.pyi @@ -4,9 +4,14 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from .. import _utilities ca: Optional[str] diff --git a/sdk/python/pulumiverse_matchbox/config/vars.py b/sdk/python/pulumiverse_matchbox/config/vars.py index 58e3c9b..ccaf7ea 100644 --- a/sdk/python/pulumiverse_matchbox/config/vars.py +++ b/sdk/python/pulumiverse_matchbox/config/vars.py @@ -4,9 +4,14 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from .. import _utilities import types diff --git a/sdk/python/pulumiverse_matchbox/group.py b/sdk/python/pulumiverse_matchbox/group.py index dda24f6..f0459d9 100644 --- a/sdk/python/pulumiverse_matchbox/group.py +++ b/sdk/python/pulumiverse_matchbox/group.py @@ -4,9 +4,14 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from . import _utilities __all__ = ['GroupArgs', 'Group'] @@ -169,6 +174,20 @@ def __init__(__self__, A Group matches (one or more) machines and declares a machine should be boot with a named `profile`. + ```python + import pulumi + import pulumiverse_matchbox as matchbox + + node1 = matchbox.Group("node1", + metadata={ + "custom_variable": "machine_specific_value_here", + }, + profile=matchbox_profile["myprofile"]["name"], + selector={ + "mac": "52:54:00:a1:9c:ae", + }) + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] metadata: Map of group metadata (optional, seldom used) @@ -187,6 +206,20 @@ def __init__(__self__, A Group matches (one or more) machines and declares a machine should be boot with a named `profile`. + ```python + import pulumi + import pulumiverse_matchbox as matchbox + + node1 = matchbox.Group("node1", + metadata={ + "custom_variable": "machine_specific_value_here", + }, + profile=matchbox_profile["myprofile"]["name"], + selector={ + "mac": "52:54:00:a1:9c:ae", + }) + ``` + :param str resource_name: The name of the resource. :param GroupArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumiverse_matchbox/profile.py b/sdk/python/pulumiverse_matchbox/profile.py index 7b4e95f..f532d76 100644 --- a/sdk/python/pulumiverse_matchbox/profile.py +++ b/sdk/python/pulumiverse_matchbox/profile.py @@ -4,9 +4,14 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from . import _utilities __all__ = ['ProfileArgs', 'Profile'] @@ -25,6 +30,7 @@ def __init__(__self__, *, The set of arguments for constructing a Profile resource. :param pulumi.Input[Sequence[pulumi.Input[str]]] args: List of kernel arguments :param pulumi.Input[str] container_linux_config: CoreOS Container Linux Config (CLC) (for backwards compatibility) + :param pulumi.Input[str] generic_config: Generic configuration :param pulumi.Input[Sequence[pulumi.Input[str]]] initrds: List of URLs to init RAM filesystems :param pulumi.Input[str] kernel: URL of the kernel image to boot :param pulumi.Input[str] name: Unqiue name for the machine matcher @@ -71,6 +77,9 @@ def container_linux_config(self, value: Optional[pulumi.Input[str]]): @property @pulumi.getter(name="genericConfig") def generic_config(self) -> Optional[pulumi.Input[str]]: + """ + Generic configuration + """ return pulumi.get(self, "generic_config") @generic_config.setter @@ -137,6 +146,7 @@ def __init__(__self__, *, Input properties used for looking up and filtering Profile resources. :param pulumi.Input[Sequence[pulumi.Input[str]]] args: List of kernel arguments :param pulumi.Input[str] container_linux_config: CoreOS Container Linux Config (CLC) (for backwards compatibility) + :param pulumi.Input[str] generic_config: Generic configuration :param pulumi.Input[Sequence[pulumi.Input[str]]] initrds: List of URLs to init RAM filesystems :param pulumi.Input[str] kernel: URL of the kernel image to boot :param pulumi.Input[str] name: Unqiue name for the machine matcher @@ -183,6 +193,9 @@ def container_linux_config(self, value: Optional[pulumi.Input[str]]): @property @pulumi.getter(name="genericConfig") def generic_config(self) -> Optional[pulumi.Input[str]]: + """ + Generic configuration + """ return pulumi.get(self, "generic_config") @generic_config.setter @@ -253,10 +266,23 @@ def __init__(__self__, A Profile defines network boot and declarative provisioning configurations. + ```python + import pulumi + + config = pulumi.Config() + os_stream = config.get("osStream") + if os_stream is None: + os_stream = "stable" + os_version = config.require("osVersion") + kernel = f"https://builds.coreos.fedoraproject.org/prod/streams/{os_stream}/builds/{os_version}/x86_64/fedora-coreos-{os_version}-live-kernel-x86_64" + initrd = f"https://builds.coreos.fedoraproject.org/prod/streams/{os_stream}/builds/{os_version}/x86_64/fedora-coreos-{os_version}-live-initramfs.x86_64.img" + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[Sequence[pulumi.Input[str]]] args: List of kernel arguments :param pulumi.Input[str] container_linux_config: CoreOS Container Linux Config (CLC) (for backwards compatibility) + :param pulumi.Input[str] generic_config: Generic configuration :param pulumi.Input[Sequence[pulumi.Input[str]]] initrds: List of URLs to init RAM filesystems :param pulumi.Input[str] kernel: URL of the kernel image to boot :param pulumi.Input[str] name: Unqiue name for the machine matcher @@ -272,6 +298,18 @@ def __init__(__self__, A Profile defines network boot and declarative provisioning configurations. + ```python + import pulumi + + config = pulumi.Config() + os_stream = config.get("osStream") + if os_stream is None: + os_stream = "stable" + os_version = config.require("osVersion") + kernel = f"https://builds.coreos.fedoraproject.org/prod/streams/{os_stream}/builds/{os_version}/x86_64/fedora-coreos-{os_version}-live-kernel-x86_64" + initrd = f"https://builds.coreos.fedoraproject.org/prod/streams/{os_stream}/builds/{os_version}/x86_64/fedora-coreos-{os_version}-live-initramfs.x86_64.img" + ``` + :param str resource_name: The name of the resource. :param ProfileArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. @@ -336,6 +374,7 @@ def get(resource_name: str, :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[Sequence[pulumi.Input[str]]] args: List of kernel arguments :param pulumi.Input[str] container_linux_config: CoreOS Container Linux Config (CLC) (for backwards compatibility) + :param pulumi.Input[str] generic_config: Generic configuration :param pulumi.Input[Sequence[pulumi.Input[str]]] initrds: List of URLs to init RAM filesystems :param pulumi.Input[str] kernel: URL of the kernel image to boot :param pulumi.Input[str] name: Unqiue name for the machine matcher @@ -372,6 +411,9 @@ def container_linux_config(self) -> pulumi.Output[Optional[str]]: @property @pulumi.getter(name="genericConfig") def generic_config(self) -> pulumi.Output[Optional[str]]: + """ + Generic configuration + """ return pulumi.get(self, "generic_config") @property diff --git a/sdk/python/pulumiverse_matchbox/provider.py b/sdk/python/pulumiverse_matchbox/provider.py index b1d8ef8..7318c40 100644 --- a/sdk/python/pulumiverse_matchbox/provider.py +++ b/sdk/python/pulumiverse_matchbox/provider.py @@ -4,9 +4,14 @@ import copy import warnings +import sys import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias from . import _utilities __all__ = ['ProviderArgs', 'Provider'] diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.toml index f2fc440..8f3d47f 100644 --- a/sdk/python/pyproject.toml +++ b/sdk/python/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "pulumiverse_matchbox" description = "A Pulumi package for creating and managing the Matchbox iPXE server." - dependencies = ["parver>=0.2.1", "pulumi>=3.0.0,<4.0.0", "semver>=2.8.1"] + dependencies = ["parver>=0.2.1", "pulumi>=3.0.0,<4.0.0", "semver>=2.8.1", "typing-extensions>=4.11; python_version < \"3.11\""] keywords = ["pulumi", "matchbox", "category/network"] readme = "README.md" requires-python = ">=3.8"