Files
pulumi-incus/sdk/nodejs/instance.ts
2025-12-08 10:47:09 -05:00

375 lines
16 KiB
TypeScript
Generated

// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
import * as utilities from "./utilities";
export class Instance extends pulumi.CustomResource {
/**
* Get an existing Instance resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: InstanceState, opts?: pulumi.CustomResourceOptions): Instance {
return new Instance(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'incus:index/instance:Instance';
/**
* Returns true if the given object is an instance of Instance. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is Instance {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Instance.__pulumiType;
}
/**
* *Optional* - The instance architecture (e.g. x86_64, aarch64). See [Architectures](https://linuxcontainers.org/incus/docs/main/architectures/) for all possible values.
*/
declare public readonly architecture: pulumi.Output<string>;
/**
* *Optional* - Map of key/value pairs of
* [instance config settings](https://linuxcontainers.org/incus/docs/main/reference/instance_options/).
*/
declare public readonly config: pulumi.Output<{[key: string]: string}>;
/**
* *Optional* - Description of the instance.
*/
declare public readonly description: pulumi.Output<string>;
/**
* *Optional* - Device definition. See reference below.
*/
declare public readonly devices: pulumi.Output<outputs.InstanceDevice[] | undefined>;
/**
* *Optional* - Boolean indicating if this instance is ephemeral. Defaults to `false`.
*/
declare public readonly ephemeral: pulumi.Output<boolean>;
/**
* *Optional* - File to upload to the instance. See reference below.
*/
declare public readonly files: pulumi.Output<outputs.InstanceFile[] | undefined>;
/**
* *Optional* - Base image from which the instance will be created. Must
* specify [an image accessible from the provider remote](https://linuxcontainers.org/incus/docs/main/reference/image_servers/).
*/
declare public readonly image: pulumi.Output<string | undefined>;
/**
* The IPv4 Address of the instance. See Instance Network
* Access for more details.
*/
declare public /*out*/ readonly ipv4Address: pulumi.Output<string>;
/**
* The IPv6 Address of the instance. See Instance Network
* Access for more details.
*/
declare public /*out*/ readonly ipv6Address: pulumi.Output<string>;
/**
* The MAC address of the detected NIC. See Instance Network
* Access for more details.
*/
declare public /*out*/ readonly macAddress: pulumi.Output<string>;
/**
* **Required** - Name of the instance.
*/
declare public readonly name: pulumi.Output<string>;
/**
* *Optional* - List of Incus config profiles to apply to the new
* instance. Profile `default` will be applied if profiles are not set (are `null`).
* However, if an empty array (`[]`) is set as a value, no profiles will be applied.
*/
declare public readonly profiles: pulumi.Output<string[]>;
/**
* *Optional* - Name of the project where the instance will be spawned.
*/
declare public readonly project: pulumi.Output<string>;
/**
* *Optional* - The remote in which the resource will be created. If
* not provided, the provider's default remote will be used.
*/
declare public readonly remote: pulumi.Output<string | undefined>;
/**
* *Optional* - Boolean indicating whether the instance should be started (running). Defaults to `true`.
*/
declare public readonly running: pulumi.Output<boolean>;
/**
* *Optional* - The souce backup file from which the instance should be restored. For handling of storage pool, see examples.
*/
declare public readonly sourceFile: pulumi.Output<string | undefined>;
/**
* *Optional* - The source instance from which the instance will be created. See reference below.
*/
declare public readonly sourceInstance: pulumi.Output<outputs.InstanceSourceInstance | undefined>;
/**
* The status of the instance.
*/
declare public /*out*/ readonly status: pulumi.Output<string>;
/**
* *Optional* - Specify a target node in a cluster.
*/
declare public readonly target: pulumi.Output<string>;
/**
* *Optional* - Instance type. Can be `container`, or `virtual-machine`. Defaults to `container`.
*/
declare public readonly type: pulumi.Output<string>;
/**
* *Optional* - WaitFor definition. See reference below.
* If `running` is set to false or instance is already running (on update), this value has no effect.
*/
declare public readonly waitFors: pulumi.Output<outputs.InstanceWaitFor[] | undefined>;
/**
* Create a Instance resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: InstanceArgs, opts?: pulumi.CustomResourceOptions)
constructor(name: string, argsOrState?: InstanceArgs | InstanceState, opts?: pulumi.CustomResourceOptions) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState as InstanceState | undefined;
resourceInputs["architecture"] = state?.architecture;
resourceInputs["config"] = state?.config;
resourceInputs["description"] = state?.description;
resourceInputs["devices"] = state?.devices;
resourceInputs["ephemeral"] = state?.ephemeral;
resourceInputs["files"] = state?.files;
resourceInputs["image"] = state?.image;
resourceInputs["ipv4Address"] = state?.ipv4Address;
resourceInputs["ipv6Address"] = state?.ipv6Address;
resourceInputs["macAddress"] = state?.macAddress;
resourceInputs["name"] = state?.name;
resourceInputs["profiles"] = state?.profiles;
resourceInputs["project"] = state?.project;
resourceInputs["remote"] = state?.remote;
resourceInputs["running"] = state?.running;
resourceInputs["sourceFile"] = state?.sourceFile;
resourceInputs["sourceInstance"] = state?.sourceInstance;
resourceInputs["status"] = state?.status;
resourceInputs["target"] = state?.target;
resourceInputs["type"] = state?.type;
resourceInputs["waitFors"] = state?.waitFors;
} else {
const args = argsOrState as InstanceArgs | undefined;
if (args?.name === undefined && !opts.urn) {
throw new Error("Missing required property 'name'");
}
resourceInputs["architecture"] = args?.architecture;
resourceInputs["config"] = args?.config;
resourceInputs["description"] = args?.description;
resourceInputs["devices"] = args?.devices;
resourceInputs["ephemeral"] = args?.ephemeral;
resourceInputs["files"] = args?.files;
resourceInputs["image"] = args?.image;
resourceInputs["name"] = args?.name;
resourceInputs["profiles"] = args?.profiles;
resourceInputs["project"] = (args?.project) ?? "default";
resourceInputs["remote"] = args?.remote;
resourceInputs["running"] = args?.running;
resourceInputs["sourceFile"] = args?.sourceFile;
resourceInputs["sourceInstance"] = args?.sourceInstance;
resourceInputs["target"] = args?.target;
resourceInputs["type"] = args?.type;
resourceInputs["waitFors"] = args?.waitFors;
resourceInputs["ipv4Address"] = undefined /*out*/;
resourceInputs["ipv6Address"] = undefined /*out*/;
resourceInputs["macAddress"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
/**
* Input properties used for looking up and filtering Instance resources.
*/
export interface InstanceState {
/**
* *Optional* - The instance architecture (e.g. x86_64, aarch64). See [Architectures](https://linuxcontainers.org/incus/docs/main/architectures/) for all possible values.
*/
architecture?: pulumi.Input<string>;
/**
* *Optional* - Map of key/value pairs of
* [instance config settings](https://linuxcontainers.org/incus/docs/main/reference/instance_options/).
*/
config?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* *Optional* - Description of the instance.
*/
description?: pulumi.Input<string>;
/**
* *Optional* - Device definition. See reference below.
*/
devices?: pulumi.Input<pulumi.Input<inputs.InstanceDevice>[]>;
/**
* *Optional* - Boolean indicating if this instance is ephemeral. Defaults to `false`.
*/
ephemeral?: pulumi.Input<boolean>;
/**
* *Optional* - File to upload to the instance. See reference below.
*/
files?: pulumi.Input<pulumi.Input<inputs.InstanceFile>[]>;
/**
* *Optional* - Base image from which the instance will be created. Must
* specify [an image accessible from the provider remote](https://linuxcontainers.org/incus/docs/main/reference/image_servers/).
*/
image?: pulumi.Input<string>;
/**
* The IPv4 Address of the instance. See Instance Network
* Access for more details.
*/
ipv4Address?: pulumi.Input<string>;
/**
* The IPv6 Address of the instance. See Instance Network
* Access for more details.
*/
ipv6Address?: pulumi.Input<string>;
/**
* The MAC address of the detected NIC. See Instance Network
* Access for more details.
*/
macAddress?: pulumi.Input<string>;
/**
* **Required** - Name of the instance.
*/
name?: pulumi.Input<string>;
/**
* *Optional* - List of Incus config profiles to apply to the new
* instance. Profile `default` will be applied if profiles are not set (are `null`).
* However, if an empty array (`[]`) is set as a value, no profiles will be applied.
*/
profiles?: pulumi.Input<pulumi.Input<string>[]>;
/**
* *Optional* - Name of the project where the instance will be spawned.
*/
project?: pulumi.Input<string>;
/**
* *Optional* - The remote in which the resource will be created. If
* not provided, the provider's default remote will be used.
*/
remote?: pulumi.Input<string>;
/**
* *Optional* - Boolean indicating whether the instance should be started (running). Defaults to `true`.
*/
running?: pulumi.Input<boolean>;
/**
* *Optional* - The souce backup file from which the instance should be restored. For handling of storage pool, see examples.
*/
sourceFile?: pulumi.Input<string>;
/**
* *Optional* - The source instance from which the instance will be created. See reference below.
*/
sourceInstance?: pulumi.Input<inputs.InstanceSourceInstance>;
/**
* The status of the instance.
*/
status?: pulumi.Input<string>;
/**
* *Optional* - Specify a target node in a cluster.
*/
target?: pulumi.Input<string>;
/**
* *Optional* - Instance type. Can be `container`, or `virtual-machine`. Defaults to `container`.
*/
type?: pulumi.Input<string>;
/**
* *Optional* - WaitFor definition. See reference below.
* If `running` is set to false or instance is already running (on update), this value has no effect.
*/
waitFors?: pulumi.Input<pulumi.Input<inputs.InstanceWaitFor>[]>;
}
/**
* The set of arguments for constructing a Instance resource.
*/
export interface InstanceArgs {
/**
* *Optional* - The instance architecture (e.g. x86_64, aarch64). See [Architectures](https://linuxcontainers.org/incus/docs/main/architectures/) for all possible values.
*/
architecture?: pulumi.Input<string>;
/**
* *Optional* - Map of key/value pairs of
* [instance config settings](https://linuxcontainers.org/incus/docs/main/reference/instance_options/).
*/
config?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* *Optional* - Description of the instance.
*/
description?: pulumi.Input<string>;
/**
* *Optional* - Device definition. See reference below.
*/
devices?: pulumi.Input<pulumi.Input<inputs.InstanceDevice>[]>;
/**
* *Optional* - Boolean indicating if this instance is ephemeral. Defaults to `false`.
*/
ephemeral?: pulumi.Input<boolean>;
/**
* *Optional* - File to upload to the instance. See reference below.
*/
files?: pulumi.Input<pulumi.Input<inputs.InstanceFile>[]>;
/**
* *Optional* - Base image from which the instance will be created. Must
* specify [an image accessible from the provider remote](https://linuxcontainers.org/incus/docs/main/reference/image_servers/).
*/
image?: pulumi.Input<string>;
/**
* **Required** - Name of the instance.
*/
name: pulumi.Input<string>;
/**
* *Optional* - List of Incus config profiles to apply to the new
* instance. Profile `default` will be applied if profiles are not set (are `null`).
* However, if an empty array (`[]`) is set as a value, no profiles will be applied.
*/
profiles?: pulumi.Input<pulumi.Input<string>[]>;
/**
* *Optional* - Name of the project where the instance will be spawned.
*/
project?: pulumi.Input<string>;
/**
* *Optional* - The remote in which the resource will be created. If
* not provided, the provider's default remote will be used.
*/
remote?: pulumi.Input<string>;
/**
* *Optional* - Boolean indicating whether the instance should be started (running). Defaults to `true`.
*/
running?: pulumi.Input<boolean>;
/**
* *Optional* - The souce backup file from which the instance should be restored. For handling of storage pool, see examples.
*/
sourceFile?: pulumi.Input<string>;
/**
* *Optional* - The source instance from which the instance will be created. See reference below.
*/
sourceInstance?: pulumi.Input<inputs.InstanceSourceInstance>;
/**
* *Optional* - Specify a target node in a cluster.
*/
target?: pulumi.Input<string>;
/**
* *Optional* - Instance type. Can be `container`, or `virtual-machine`. Defaults to `container`.
*/
type?: pulumi.Input<string>;
/**
* *Optional* - WaitFor definition. See reference below.
* If `running` is set to false or instance is already running (on update), this value has no effect.
*/
waitFors?: pulumi.Input<pulumi.Input<inputs.InstanceWaitFor>[]>;
}