@pulumi/openstack
Version:
A Pulumi package for creating and managing OpenStack cloud resources.
161 lines • 7.32 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Image = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a V2 Image resource within OpenStack Glance.
*
* > **Note:** All arguments including the source image URL password will be
* stored in the raw state as plain-text. Read more about sensitive data in
* state.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const rancheros = new openstack.images.Image("rancheros", {
* name: "RancherOS",
* imageSourceUrl: "https://releases.rancher.com/os/latest/rancheros-openstack.img",
* containerFormat: "bare",
* diskFormat: "qcow2",
* properties: {
* key: "value",
* },
* });
* ```
*
* ## Notes
*
* ### Properties
*
* This resource supports the ability to add properties to a resource during
* creation as well as add, update, and delete properties during an update of this
* resource.
*
* Newer versions of OpenStack are adding some read-only properties to each image.
* These properties start with the prefix `os_`. If these properties are detected,
* this resource will automatically reconcile these with the user-provided
* properties.
*
* In addition, the `directUrl` and `stores` properties are also automatically reconciled if the
* Image Service set it.
*
* ## Import
*
* Images can be imported using the `id`, e.g.
*
* ```sh
* $ pulumi import openstack:images/image:Image rancheros 89c60255-9bd6-460c-822a-e2b959ede9d2
* ```
*/
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.
*/
static get(name, id, state, opts) {
return new Image(name, state, { ...opts, id: id });
}
/**
* 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.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Image.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["checksum"] = state?.checksum;
resourceInputs["containerFormat"] = state?.containerFormat;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["decompress"] = state?.decompress;
resourceInputs["diskFormat"] = state?.diskFormat;
resourceInputs["file"] = state?.file;
resourceInputs["hidden"] = state?.hidden;
resourceInputs["imageCachePath"] = state?.imageCachePath;
resourceInputs["imageId"] = state?.imageId;
resourceInputs["imageSourcePassword"] = state?.imageSourcePassword;
resourceInputs["imageSourceUrl"] = state?.imageSourceUrl;
resourceInputs["imageSourceUsername"] = state?.imageSourceUsername;
resourceInputs["localFilePath"] = state?.localFilePath;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["minDiskGb"] = state?.minDiskGb;
resourceInputs["minRamMb"] = state?.minRamMb;
resourceInputs["name"] = state?.name;
resourceInputs["owner"] = state?.owner;
resourceInputs["properties"] = state?.properties;
resourceInputs["protected"] = state?.protected;
resourceInputs["region"] = state?.region;
resourceInputs["schema"] = state?.schema;
resourceInputs["sizeBytes"] = state?.sizeBytes;
resourceInputs["status"] = state?.status;
resourceInputs["tags"] = state?.tags;
resourceInputs["updatedAt"] = state?.updatedAt;
resourceInputs["verifyChecksum"] = state?.verifyChecksum;
resourceInputs["visibility"] = state?.visibility;
resourceInputs["webDownload"] = state?.webDownload;
}
else {
const args = argsOrState;
if (args?.containerFormat === undefined && !opts.urn) {
throw new Error("Missing required property 'containerFormat'");
}
if (args?.diskFormat === undefined && !opts.urn) {
throw new Error("Missing required property 'diskFormat'");
}
resourceInputs["containerFormat"] = args?.containerFormat;
resourceInputs["decompress"] = args?.decompress;
resourceInputs["diskFormat"] = args?.diskFormat;
resourceInputs["hidden"] = args?.hidden;
resourceInputs["imageCachePath"] = args?.imageCachePath;
resourceInputs["imageId"] = args?.imageId;
resourceInputs["imageSourcePassword"] = args?.imageSourcePassword ? pulumi.secret(args.imageSourcePassword) : undefined;
resourceInputs["imageSourceUrl"] = args?.imageSourceUrl;
resourceInputs["imageSourceUsername"] = args?.imageSourceUsername;
resourceInputs["localFilePath"] = args?.localFilePath;
resourceInputs["minDiskGb"] = args?.minDiskGb;
resourceInputs["minRamMb"] = args?.minRamMb;
resourceInputs["name"] = args?.name;
resourceInputs["properties"] = args?.properties;
resourceInputs["protected"] = args?.protected;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["verifyChecksum"] = args?.verifyChecksum;
resourceInputs["visibility"] = args?.visibility;
resourceInputs["webDownload"] = args?.webDownload;
resourceInputs["checksum"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["file"] = undefined /*out*/;
resourceInputs["metadata"] = undefined /*out*/;
resourceInputs["owner"] = undefined /*out*/;
resourceInputs["schema"] = undefined /*out*/;
resourceInputs["sizeBytes"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["imageSourcePassword"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Image.__pulumiType, name, resourceInputs, opts);
}
}
exports.Image = Image;
/** @internal */
Image.__pulumiType = 'openstack:images/image:Image';
//# sourceMappingURL=image.js.map