@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
146 lines • 6.05 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.Server = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* The UpCloud server resource allows the creation, update and deletion of [cloud servers](https://upcloud.com/products/cloud-servers).
*
* > To deploy a GPU server, select a plan with `GPU-` prefix, e.g., `GPU-8xCPU-64GB-1xL40S`. Use `upctl zone devices` command to list per zone GPU availability.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as upcloud from "@upcloud/pulumi-upcloud";
*
* const example = new upcloud.Server("example", {
* hostname: "terraform.example.tld",
* zone: "de-fra1",
* plan: "1xCPU-1GB",
* metadata: true,
* template: {
* storage: "Ubuntu Server 24.04 LTS (Noble Numbat)",
* size: 25,
* backupRules: [{
* interval: "daily",
* time: "0100",
* retention: 8,
* }],
* },
* networkInterfaces: [{
* type: "public",
* }],
* labels: {
* env: "dev",
* production: "false",
* },
* login: {
* user: "myusername",
* keys: ["<YOUR SSH PUBLIC KEY>"],
* },
* });
* ```
*
* ## Import
*
* The `pulumi import` command can be used, for example:
*
* ```sh
* $ pulumi import upcloud:index/server:Server example_server ead4544f-10bf-42a3-b98a-a0fea2e2ad14
* ```
*/
class Server extends pulumi.CustomResource {
/**
* Get an existing Server 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 Server(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Server. 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'] === Server.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["bootOrder"] = state?.bootOrder;
resourceInputs["cpu"] = state?.cpu;
resourceInputs["firewall"] = state?.firewall;
resourceInputs["host"] = state?.host;
resourceInputs["hostname"] = state?.hostname;
resourceInputs["hotResize"] = state?.hotResize;
resourceInputs["labels"] = state?.labels;
resourceInputs["login"] = state?.login;
resourceInputs["mem"] = state?.mem;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["networkInterfaces"] = state?.networkInterfaces;
resourceInputs["nicModel"] = state?.nicModel;
resourceInputs["plan"] = state?.plan;
resourceInputs["serverGroup"] = state?.serverGroup;
resourceInputs["simpleBackup"] = state?.simpleBackup;
resourceInputs["storageDevices"] = state?.storageDevices;
resourceInputs["tags"] = state?.tags;
resourceInputs["template"] = state?.template;
resourceInputs["timezone"] = state?.timezone;
resourceInputs["title"] = state?.title;
resourceInputs["userData"] = state?.userData;
resourceInputs["videoModel"] = state?.videoModel;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.hostname === undefined && !opts.urn) {
throw new Error("Missing required property 'hostname'");
}
if (args?.zone === undefined && !opts.urn) {
throw new Error("Missing required property 'zone'");
}
resourceInputs["bootOrder"] = args?.bootOrder;
resourceInputs["cpu"] = args?.cpu;
resourceInputs["firewall"] = args?.firewall;
resourceInputs["host"] = args?.host;
resourceInputs["hostname"] = args?.hostname;
resourceInputs["hotResize"] = args?.hotResize;
resourceInputs["labels"] = args?.labels;
resourceInputs["login"] = args?.login;
resourceInputs["mem"] = args?.mem;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["networkInterfaces"] = args?.networkInterfaces;
resourceInputs["nicModel"] = args?.nicModel;
resourceInputs["plan"] = args?.plan;
resourceInputs["serverGroup"] = args?.serverGroup;
resourceInputs["simpleBackup"] = args?.simpleBackup;
resourceInputs["storageDevices"] = args?.storageDevices;
resourceInputs["tags"] = args?.tags;
resourceInputs["template"] = args?.template;
resourceInputs["timezone"] = args?.timezone;
resourceInputs["title"] = args?.title;
resourceInputs["userData"] = args?.userData;
resourceInputs["videoModel"] = args?.videoModel;
resourceInputs["zone"] = args?.zone;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Server.__pulumiType, name, resourceInputs, opts);
}
}
exports.Server = Server;
/** @internal */
Server.__pulumiType = 'upcloud:index/server:Server';
//# sourceMappingURL=server.js.map