UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

130 lines 5.81 kB
"use strict"; // *** 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.Image = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Creates and manages Scaleway Compute Images. * For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/instance/#path-images-list-instance-images). * * ## Example Usage * * ### From a volume * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const volume = new scaleway.instance.Volume("volume", { * type: "b_ssd", * sizeInGb: 20, * }); * const volumeSnapshot = new scaleway.instance.Snapshot("volume_snapshot", {volumeId: volume.id}); * const volumeImage = new scaleway.instance.Image("volume_image", { * name: "image_from_volume", * rootVolumeId: volumeSnapshot.id, * }); * ``` * * ### From a server * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const server = new scaleway.instance.Server("server", { * image: "ubuntu_jammy", * type: "DEV1-S", * }); * const serverSnapshot = new scaleway.instance.Snapshot("server_snapshot", {volumeId: main.rootVolume[0].volumeId}); * const serverImage = new scaleway.instance.Image("server_image", { * name: "image_from_server", * rootVolumeId: serverSnapshot.id, * }); * ``` * * ## Import * * Images can be imported using the `{zone}/{id}`, e.g. * * bash * * ```sh * $ pulumi import scaleway:instance/image:Image main fr-par-1/11111111-1111-1111-1111-111111111111 * ``` */ 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, Object.assign(Object.assign({}, 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["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); const aliasOpts = { aliases: [{ type: "scaleway:index/instanceImage:InstanceImage" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(Image.__pulumiType, name, resourceInputs, opts); } } exports.Image = Image; /** @internal */ Image.__pulumiType = 'scaleway:instance/image:Image'; //# sourceMappingURL=image.js.map