UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

139 lines 5.76 kB
"use strict"; // *** 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.Cron = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * The `scaleway.functions.Cron` resource allows you to create and manage CRON triggers for Scaleway [Serverless Functions](https://www.scaleway.com/en/docs/serverless/functions/). * * Refer to the Functions CRON triggers [documentation](https://www.scaleway.com/en/docs/serverless/functions/how-to/add-trigger-to-a-function/) and [API documentation](https://www.scaleway.com/en/developers/api/serverless-functions/#path-triggers-list-all-triggers) for more information. * * ## Example Usage * * The following command allows you to add a CRON trigger to a Serverless Function. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.functions.Namespace("main", {name: "test-cron"}); * const mainFunction = new scaleway.functions.Function("main", { * name: "test-cron", * namespaceId: main.id, * runtime: "node14", * privacy: "private", * handler: "handler.handle", * }); * const mainCron = new scaleway.functions.Cron("main", { * name: "test-cron", * functionId: mainFunction.id, * schedule: "0 0 * * *", * args: JSON.stringify({ * test: "scw", * }), * }); * const func = new scaleway.functions.Cron("func", { * functionId: mainFunction.id, * schedule: "0 1 * * *", * args: JSON.stringify({ * my_var: "terraform", * }), * }); * ``` * * ## Import * * Function Cron can be imported using `{region}/{id}`, as shown below: * * ```sh * $ pulumi import scaleway:functions/cron:Cron main fr-par/11111111-1111-1111-1111-111111111111 * ``` */ class Cron extends pulumi.CustomResource { /** * Get an existing Cron 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 Cron(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'scaleway:functions/cron:Cron'; /** * Returns true if the given object is an instance of Cron. 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'] === Cron.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["args"] = state?.args; resourceInputs["functionId"] = state?.functionId; resourceInputs["name"] = state?.name; resourceInputs["region"] = state?.region; resourceInputs["schedule"] = state?.schedule; resourceInputs["status"] = state?.status; } else { const args = argsOrState; if (args?.args === undefined && !opts.urn) { throw new Error("Missing required property 'args'"); } if (args?.functionId === undefined && !opts.urn) { throw new Error("Missing required property 'functionId'"); } if (args?.schedule === undefined && !opts.urn) { throw new Error("Missing required property 'schedule'"); } resourceInputs["args"] = args?.args; resourceInputs["functionId"] = args?.functionId; resourceInputs["name"] = args?.name; resourceInputs["region"] = args?.region; resourceInputs["schedule"] = args?.schedule; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const aliasOpts = { aliases: [{ type: "scaleway:index/functionCron:FunctionCron" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(Cron.__pulumiType, name, resourceInputs, opts); } } exports.Cron = Cron; //# sourceMappingURL=cron.js.map