Files
pulumi-incus/sdk/nodejs/instanceSnapshot.ts

196 lines
6.2 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 utilities from "./utilities";
/**
* ## # incus.InstanceSnapshot
*
* Manages a snapshot of an Incus instance.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as incus from "@kiterun/incus";
*
* const instance = new incus.Instance("instance", {
* name: "my-instance",
* image: "ubuntu",
* ephemeral: false,
* });
* const snap1 = new incus.InstanceSnapshot("snap1", {
* name: "my-snapshot-1",
* instance: instance.name,
* });
* ```
*/
export class InstanceSnapshot extends pulumi.CustomResource {
/**
* Get an existing InstanceSnapshot 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?: InstanceSnapshotState,
opts?: pulumi.CustomResourceOptions,
): InstanceSnapshot {
return new InstanceSnapshot(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = "incus:index/instanceSnapshot:InstanceSnapshot";
/**
* Returns true if the given object is an instance of InstanceSnapshot. 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 InstanceSnapshot {
if (obj === undefined || obj === null) {
return false;
}
return obj["__pulumiType"] === InstanceSnapshot.__pulumiType;
}
/**
* The time Incus reported the snapshot was successfully created,
* in UTC.
*/
declare public readonly /*out*/ createdAt: pulumi.Output<number>;
/**
* **Required** - The name of the instance to snapshot.
*/
declare public readonly instance: pulumi.Output<string>;
/**
* **Required** - Name of the snapshot.
*/
declare public readonly name: pulumi.Output<string>;
/**
* *Optional* - Name of the project where the snapshot will be stored.
*/
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* - Set to `true` to create a stateful snapshot,
* `false` for stateless. Stateful snapshots include runtime state. Defaults to
* `false`.
*/
declare public readonly stateful: pulumi.Output<boolean>;
/**
* Create a InstanceSnapshot 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: InstanceSnapshotArgs, opts?: pulumi.CustomResourceOptions);
constructor(
name: string,
argsOrState?: InstanceSnapshotArgs | InstanceSnapshotState,
opts?: pulumi.CustomResourceOptions,
) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState as InstanceSnapshotState | undefined;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["instance"] = state?.instance;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["remote"] = state?.remote;
resourceInputs["stateful"] = state?.stateful;
} else {
const args = argsOrState as InstanceSnapshotArgs | undefined;
if (args?.instance === undefined && !opts.urn) {
throw new Error("Missing required property 'instance'");
}
if (args?.name === undefined && !opts.urn) {
throw new Error("Missing required property 'name'");
}
resourceInputs["instance"] = args?.instance;
resourceInputs["name"] = args?.name;
resourceInputs["project"] = args?.project ?? "default";
resourceInputs["remote"] = args?.remote;
resourceInputs["stateful"] = args?.stateful;
resourceInputs["createdAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(InstanceSnapshot.__pulumiType, name, resourceInputs, opts);
}
}
/**
* Input properties used for looking up and filtering InstanceSnapshot resources.
*/
export interface InstanceSnapshotState {
/**
* The time Incus reported the snapshot was successfully created,
* in UTC.
*/
createdAt?: pulumi.Input<number>;
/**
* **Required** - The name of the instance to snapshot.
*/
instance?: pulumi.Input<string>;
/**
* **Required** - Name of the snapshot.
*/
name?: pulumi.Input<string>;
/**
* *Optional* - Name of the project where the snapshot 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* - Set to `true` to create a stateful snapshot,
* `false` for stateless. Stateful snapshots include runtime state. Defaults to
* `false`.
*/
stateful?: pulumi.Input<boolean>;
}
/**
* The set of arguments for constructing a InstanceSnapshot resource.
*/
export interface InstanceSnapshotArgs {
/**
* **Required** - The name of the instance to snapshot.
*/
instance: pulumi.Input<string>;
/**
* **Required** - Name of the snapshot.
*/
name: pulumi.Input<string>;
/**
* *Optional* - Name of the project where the snapshot 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* - Set to `true` to create a stateful snapshot,
* `false` for stateless. Stateful snapshots include runtime state. Defaults to
* `false`.
*/
stateful?: pulumi.Input<boolean>;
}