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

243 lines
8.8 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";
/**
* ## # incus.Image
*
* Manages a locally-stored Incus image.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as incus from "@kiterun/incus";
*
* const alpine = new incus.Image("alpine", {sourceImage: {
* remote: "images",
* name: "alpine/edge",
* }});
* const test1 = new incus.Instance("test1", {
* name: "test1",
* image: alpine.fingerprint,
* ephemeral: false,
* });
* ```
*
* ## Image alias Example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as incus from "@kiterun/incus";
*
* const alpine = new incus.Image("alpine", {
* sourceImage: {
* remote: "images",
* name: "alpine/edge",
* },
* aliases: [
* {
* name: "alpine",
* description: "Alpine Linux",
* },
* {
* name: "alpine-edge",
* description: "Alpine Linux Edge",
* },
* ],
* });
* ```
*
* ## Notes
*
* * See the Incus [documentation](https://linuxcontainers.org/incus/docs/main/howto/images_remote) for more info on default image remotes.
*/
export class Image extends pulumi.CustomResource {
/**
* Get an existing Image 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?: ImageState, opts?: pulumi.CustomResourceOptions): Image {
return new Image(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'incus:index/image:Image';
/**
* Returns true if the given object is an instance of Image. 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 Image {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Image.__pulumiType;
}
/**
* Image alias
*/
declare public readonly aliases: pulumi.Output<outputs.ImageAlias[] | undefined>;
/**
* The list of aliases that were copied from the
* `sourceImage`.
*/
declare public /*out*/ readonly copiedAliases: pulumi.Output<string[]>;
/**
* The datetime of image creation, in Unix time.
*/
declare public /*out*/ readonly createdAt: pulumi.Output<number>;
/**
* The unique hash fingperint of the image.
*/
declare public /*out*/ readonly fingerprint: pulumi.Output<string>;
/**
* *Optional* - Name of the project where the image will be stored.
*/
declare public readonly project: pulumi.Output<string | undefined>;
/**
* *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>;
declare public /*out*/ readonly resourceId: pulumi.Output<string>;
/**
* *Optional* - The image file from the local file system from which the image will be created. See reference below.
*/
declare public readonly sourceFile: pulumi.Output<outputs.ImageSourceFile | undefined>;
/**
* *Optional* - The source image from which the image will be created. See reference below.
*/
declare public readonly sourceImage: pulumi.Output<outputs.ImageSourceImage | undefined>;
/**
* *Optional* - The source instance from which the image will be created. See reference below.
*/
declare public readonly sourceInstance: pulumi.Output<outputs.ImageSourceInstance | undefined>;
/**
* Create a Image 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?: ImageArgs, opts?: pulumi.CustomResourceOptions)
constructor(name: string, argsOrState?: ImageArgs | ImageState, opts?: pulumi.CustomResourceOptions) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState as ImageState | undefined;
resourceInputs["aliases"] = state?.aliases;
resourceInputs["copiedAliases"] = state?.copiedAliases;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["fingerprint"] = state?.fingerprint;
resourceInputs["project"] = state?.project;
resourceInputs["remote"] = state?.remote;
resourceInputs["resourceId"] = state?.resourceId;
resourceInputs["sourceFile"] = state?.sourceFile;
resourceInputs["sourceImage"] = state?.sourceImage;
resourceInputs["sourceInstance"] = state?.sourceInstance;
} else {
const args = argsOrState as ImageArgs | undefined;
resourceInputs["aliases"] = args?.aliases;
resourceInputs["project"] = args?.project;
resourceInputs["remote"] = args?.remote;
resourceInputs["sourceFile"] = args?.sourceFile;
resourceInputs["sourceImage"] = args?.sourceImage;
resourceInputs["sourceInstance"] = args?.sourceInstance;
resourceInputs["copiedAliases"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["fingerprint"] = undefined /*out*/;
resourceInputs["resourceId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Image.__pulumiType, name, resourceInputs, opts);
}
}
/**
* Input properties used for looking up and filtering Image resources.
*/
export interface ImageState {
/**
* Image alias
*/
aliases?: pulumi.Input<pulumi.Input<inputs.ImageAlias>[]>;
/**
* The list of aliases that were copied from the
* `sourceImage`.
*/
copiedAliases?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The datetime of image creation, in Unix time.
*/
createdAt?: pulumi.Input<number>;
/**
* The unique hash fingperint of the image.
*/
fingerprint?: pulumi.Input<string>;
/**
* *Optional* - Name of the project where the image will be stored.
*/
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>;
resourceId?: pulumi.Input<string>;
/**
* *Optional* - The image file from the local file system from which the image will be created. See reference below.
*/
sourceFile?: pulumi.Input<inputs.ImageSourceFile>;
/**
* *Optional* - The source image from which the image will be created. See reference below.
*/
sourceImage?: pulumi.Input<inputs.ImageSourceImage>;
/**
* *Optional* - The source instance from which the image will be created. See reference below.
*/
sourceInstance?: pulumi.Input<inputs.ImageSourceInstance>;
}
/**
* The set of arguments for constructing a Image resource.
*/
export interface ImageArgs {
/**
* Image alias
*/
aliases?: pulumi.Input<pulumi.Input<inputs.ImageAlias>[]>;
/**
* *Optional* - Name of the project where the image will be stored.
*/
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* - The image file from the local file system from which the image will be created. See reference below.
*/
sourceFile?: pulumi.Input<inputs.ImageSourceFile>;
/**
* *Optional* - The source image from which the image will be created. See reference below.
*/
sourceImage?: pulumi.Input<inputs.ImageSourceImage>;
/**
* *Optional* - The source instance from which the image will be created. See reference below.
*/
sourceInstance?: pulumi.Input<inputs.ImageSourceInstance>;
}