@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
151 lines • 6.45 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.JobDefinition = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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.
*
* bash
*
* ```sh
* $ pulumi import scaleway:index/jobDefinition:JobDefinition job fr-par/11111111-1111-1111-1111-111111111111
* ```
*
* @deprecated scaleway.index/jobdefinition.JobDefinition has been deprecated in favor of scaleway.job/definition.Definition
*/
class JobDefinition extends pulumi.CustomResource {
/**
* Get an existing JobDefinition 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) {
pulumi.log.warn("JobDefinition is deprecated: scaleway.index/jobdefinition.JobDefinition has been deprecated in favor of scaleway.job/definition.Definition");
return new JobDefinition(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of JobDefinition. 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'] === JobDefinition.__pulumiType;
}
/** @deprecated scaleway.index/jobdefinition.JobDefinition has been deprecated in favor of scaleway.job/definition.Definition */
constructor(name, argsOrState, opts) {
pulumi.log.warn("JobDefinition is deprecated: scaleway.index/jobdefinition.JobDefinition has been deprecated in favor of scaleway.job/definition.Definition");
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["command"] = state ? state.command : undefined;
resourceInputs["cpuLimit"] = state ? state.cpuLimit : undefined;
resourceInputs["cron"] = state ? state.cron : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["env"] = state ? state.env : undefined;
resourceInputs["imageUri"] = state ? state.imageUri : undefined;
resourceInputs["memoryLimit"] = state ? state.memoryLimit : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["secretReferences"] = state ? state.secretReferences : undefined;
resourceInputs["timeout"] = state ? state.timeout : undefined;
}
else {
const args = argsOrState;
if ((!args || args.cpuLimit === undefined) && !opts.urn) {
throw new Error("Missing required property 'cpuLimit'");
}
if ((!args || args.memoryLimit === undefined) && !opts.urn) {
throw new Error("Missing required property 'memoryLimit'");
}
resourceInputs["command"] = args ? args.command : undefined;
resourceInputs["cpuLimit"] = args ? args.cpuLimit : undefined;
resourceInputs["cron"] = args ? args.cron : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["env"] = args ? args.env : undefined;
resourceInputs["imageUri"] = args ? args.imageUri : undefined;
resourceInputs["memoryLimit"] = args ? args.memoryLimit : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["secretReferences"] = args ? args.secretReferences : undefined;
resourceInputs["timeout"] = args ? args.timeout : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(JobDefinition.__pulumiType, name, resourceInputs, opts);
}
}
exports.JobDefinition = JobDefinition;
/** @internal */
JobDefinition.__pulumiType = 'scaleway:index/jobDefinition:JobDefinition';
//# sourceMappingURL=jobDefinition.js.map