@lbrlabs/pulumi-scaleway
Version:
A Pulumi package for creating and managing scaleway cloud resources.
120 lines • 5.67 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstanceImage = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Creates and manages Scaleway Compute Images.
* For more information, see [the documentation](https://developers.scaleway.com/en/products/instance/api/#images-41389b).
*
* ## Example
*
* ### From a volume
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const volume = new scaleway.InstanceVolume("volume", {
* type: "b_ssd",
* sizeInGb: 20,
* });
* const volumeSnapshot = new scaleway.InstanceSnapshot("volumeSnapshot", {volumeId: volume.id});
* const volumeImage = new scaleway.InstanceImage("volumeImage", {rootVolumeId: volumeSnapshot.id});
* ```
*
* ### From a server
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@lbrlabs/pulumi-scaleway";
*
* const server = new scaleway.InstanceServer("server", {
* image: "ubuntu_jammy",
* type: "DEV1-S",
* });
* const serverSnapshot = new scaleway.InstanceSnapshot("serverSnapshot", {volumeId: scaleway_instance_server.main.root_volume[0].volume_id});
* const serverImage = new scaleway.InstanceImage("serverImage", {rootVolumeId: serverSnapshot.id});
* ```
*
* ## Import
*
* Images can be imported using the `{zone}/{id}`, e.g. bash
*
* ```sh
* $ pulumi import scaleway:index/instanceImage:InstanceImage main fr-par-1/11111111-1111-1111-1111-111111111111
* ```
*/
class InstanceImage extends pulumi.CustomResource {
/**
* Get an existing InstanceImage 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 InstanceImage(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of InstanceImage. 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'] === InstanceImage.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["additionalVolumeIds"] = state ? state.additionalVolumeIds : undefined;
resourceInputs["additionalVolumes"] = state ? state.additionalVolumes : undefined;
resourceInputs["architecture"] = state ? state.architecture : undefined;
resourceInputs["creationDate"] = state ? state.creationDate : undefined;
resourceInputs["fromServerId"] = state ? state.fromServerId : undefined;
resourceInputs["modificationDate"] = state ? state.modificationDate : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["organizationId"] = state ? state.organizationId : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["public"] = state ? state.public : undefined;
resourceInputs["rootVolumeId"] = state ? state.rootVolumeId : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["zone"] = state ? state.zone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.rootVolumeId === undefined) && !opts.urn) {
throw new Error("Missing required property 'rootVolumeId'");
}
resourceInputs["additionalVolumeIds"] = args ? args.additionalVolumeIds : undefined;
resourceInputs["architecture"] = args ? args.architecture : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["public"] = args ? args.public : undefined;
resourceInputs["rootVolumeId"] = args ? args.rootVolumeId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["zone"] = args ? args.zone : undefined;
resourceInputs["additionalVolumes"] = undefined /*out*/;
resourceInputs["creationDate"] = undefined /*out*/;
resourceInputs["fromServerId"] = undefined /*out*/;
resourceInputs["modificationDate"] = undefined /*out*/;
resourceInputs["organizationId"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(InstanceImage.__pulumiType, name, resourceInputs, opts);
}
}
exports.InstanceImage = InstanceImage;
/** @internal */
InstanceImage.__pulumiType = 'scaleway:index/instanceImage:InstanceImage';
//# sourceMappingURL=instanceImage.js.map