@muhlba91/pulumi-proxmoxve
Version:
A Pulumi package for creating and managing Proxmox Virtual Environment cloud resources.
158 lines • 5.47 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as outputs from "./types/output";
/**
* Retrieves a list of files available in a datastore on a specific Proxmox VE node.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
* import * as std from "@pulumi/std";
*
* export = async () => {
* const isoFiles = await proxmoxve.getFiles({
* nodeName: "pve",
* datastoreId: "local",
* contentType: "iso",
* });
* const imageExists = (await std.anytrue({
* input: .map(f => (f.fileName == "noble-server-cloudimg-amd64.img")),
* })).result;
* // Only download if the image doesn't already exist
* const ubuntuNoble: proxmoxve.download.FileLegacy[] = [];
* for (const range = {value: 0}; range.value < (imageExists ? 0 : 1); range.value++) {
* ubuntuNoble.push(new proxmoxve.download.FileLegacy(`ubuntu_noble-${range.value}`, {
* datastoreId: "local",
* nodeName: "pve",
* contentType: "iso",
* url: "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img",
* }));
* }
* // List all files without filtering
* const allFiles = await proxmoxve.getFiles({
* nodeName: "pve",
* datastoreId: "local",
* });
* return {
* isoFileCount: isoFiles.files.length,
* allFileNames: .map(f => (f.fileName)),
* };
* }
* ```
*/
export declare function getFiles(args: GetFilesArgs, opts?: pulumi.InvokeOptions): Promise<GetFilesResult>;
/**
* A collection of arguments for invoking getFiles.
*/
export interface GetFilesArgs {
/**
* The content type to filter by. When set, only files of this type are returned. Valid values are `backup`, `images`, `import`, `iso`, `rootdir`, `snippets`, `vztmpl`.
*/
contentType?: string;
/**
* The identifier of the datastore.
*/
datastoreId: string;
/**
* A regular expression to filter files by name. When set, only files whose name matches the expression are returned.
*/
fileNameRegex?: string;
/**
* The name of the node.
*/
nodeName: string;
}
/**
* A collection of values returned by getFiles.
*/
export interface GetFilesResult {
/**
* The content type to filter by. When set, only files of this type are returned. Valid values are `backup`, `images`, `import`, `iso`, `rootdir`, `snippets`, `vztmpl`.
*/
readonly contentType?: string;
/**
* The identifier of the datastore.
*/
readonly datastoreId: string;
/**
* A regular expression to filter files by name. When set, only files whose name matches the expression are returned.
*/
readonly fileNameRegex?: string;
/**
* The list of files in the datastore.
*/
readonly files: outputs.GetFilesFile[];
/**
* The provider-assigned unique ID for this managed resource.
*/
readonly id: string;
/**
* The name of the node.
*/
readonly nodeName: string;
}
/**
* Retrieves a list of files available in a datastore on a specific Proxmox VE node.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
* import * as std from "@pulumi/std";
*
* export = async () => {
* const isoFiles = await proxmoxve.getFiles({
* nodeName: "pve",
* datastoreId: "local",
* contentType: "iso",
* });
* const imageExists = (await std.anytrue({
* input: .map(f => (f.fileName == "noble-server-cloudimg-amd64.img")),
* })).result;
* // Only download if the image doesn't already exist
* const ubuntuNoble: proxmoxve.download.FileLegacy[] = [];
* for (const range = {value: 0}; range.value < (imageExists ? 0 : 1); range.value++) {
* ubuntuNoble.push(new proxmoxve.download.FileLegacy(`ubuntu_noble-${range.value}`, {
* datastoreId: "local",
* nodeName: "pve",
* contentType: "iso",
* url: "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img",
* }));
* }
* // List all files without filtering
* const allFiles = await proxmoxve.getFiles({
* nodeName: "pve",
* datastoreId: "local",
* });
* return {
* isoFileCount: isoFiles.files.length,
* allFileNames: .map(f => (f.fileName)),
* };
* }
* ```
*/
export declare function getFilesOutput(args: GetFilesOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetFilesResult>;
/**
* A collection of arguments for invoking getFiles.
*/
export interface GetFilesOutputArgs {
/**
* The content type to filter by. When set, only files of this type are returned. Valid values are `backup`, `images`, `import`, `iso`, `rootdir`, `snippets`, `vztmpl`.
*/
contentType?: pulumi.Input<string | undefined>;
/**
* The identifier of the datastore.
*/
datastoreId: pulumi.Input<string>;
/**
* A regular expression to filter files by name. When set, only files whose name matches the expression are returned.
*/
fileNameRegex?: pulumi.Input<string | undefined>;
/**
* The name of the node.
*/
nodeName: pulumi.Input<string>;
}
//# sourceMappingURL=getFiles.d.ts.map