@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
183 lines • 7.34 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Definition = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Creates and manages a Scaleway Serverless Job Definition. For more information, see the [Go API documentation](https://pkg.go.dev/github.com/scaleway/scaleway-sdk-go@master/api/jobs/v1alpha1).
*
* ## Example Usage
*
* ### Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const main = new scaleway.job.Definition("main", {
* name: "testjob",
* cpuLimit: 140,
* memoryLimit: 256,
* imageUri: "docker.io/alpine:latest",
* command: "ls",
* timeout: "10m",
* env: {
* foo: "bar",
* },
* cron: {
* schedule: "5 4 1 * *",
* timezone: "Europe/Paris",
* },
* });
* ```
*
* ### With Secret Reference
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const main = new scaleway.job.Definition("main", {
* name: "testjob",
* cpuLimit: 140,
* memoryLimit: 256,
* imageUri: "docker.io/alpine:latest",
* command: "ls",
* timeout: "10m",
* cron: {
* schedule: "5 4 1 * *",
* timezone: "Europe/Paris",
* },
* secretReferences: [
* {
* secretId: "11111111-1111-1111-1111-111111111111",
* file: "/home/dev/secret_file",
* },
* {
* secretId: jobSecret.id,
* secretVersion: "1",
* environment: "FOO",
* },
* ],
* });
* ```
*
* ## Import
*
* Serverless Jobs can be imported using the `{region}/{id}`, e.g.
*
* ```sh
* $ pulumi import scaleway:job/definition:Definition job fr-par/11111111-1111-1111-1111-111111111111
* ```
*/
class Definition extends pulumi.CustomResource {
/**
* Get an existing Definition 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 Definition(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'scaleway:job/definition:Definition';
/**
* Returns true if the given object is an instance of Definition. 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'] === Definition.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["args"] = state?.args;
resourceInputs["command"] = state?.command;
resourceInputs["cpuLimit"] = state?.cpuLimit;
resourceInputs["cron"] = state?.cron;
resourceInputs["description"] = state?.description;
resourceInputs["env"] = state?.env;
resourceInputs["imageUri"] = state?.imageUri;
resourceInputs["localStorageCapacity"] = state?.localStorageCapacity;
resourceInputs["memoryLimit"] = state?.memoryLimit;
resourceInputs["name"] = state?.name;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["region"] = state?.region;
resourceInputs["retryPolicy"] = state?.retryPolicy;
resourceInputs["secretReferences"] = state?.secretReferences;
resourceInputs["startupCommands"] = state?.startupCommands;
resourceInputs["timeout"] = state?.timeout;
}
else {
const args = argsOrState;
if (args?.cpuLimit === undefined && !opts.urn) {
throw new Error("Missing required property 'cpuLimit'");
}
if (args?.imageUri === undefined && !opts.urn) {
throw new Error("Missing required property 'imageUri'");
}
if (args?.localStorageCapacity === undefined && !opts.urn) {
throw new Error("Missing required property 'localStorageCapacity'");
}
if (args?.memoryLimit === undefined && !opts.urn) {
throw new Error("Missing required property 'memoryLimit'");
}
resourceInputs["args"] = args?.args;
resourceInputs["command"] = args?.command;
resourceInputs["cpuLimit"] = args?.cpuLimit;
resourceInputs["cron"] = args?.cron;
resourceInputs["description"] = args?.description;
resourceInputs["env"] = args?.env;
resourceInputs["imageUri"] = args?.imageUri;
resourceInputs["localStorageCapacity"] = args?.localStorageCapacity;
resourceInputs["memoryLimit"] = args?.memoryLimit;
resourceInputs["name"] = args?.name;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["region"] = args?.region;
resourceInputs["retryPolicy"] = args?.retryPolicy;
resourceInputs["secretReferences"] = args?.secretReferences;
resourceInputs["startupCommands"] = args?.startupCommands;
resourceInputs["timeout"] = args?.timeout;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "scaleway:index/jobDefinition:JobDefinition" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(Definition.__pulumiType, name, resourceInputs, opts);
}
}
exports.Definition = Definition;
//# sourceMappingURL=definition.js.map