UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

181 lines 7.13 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.Trigger = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * The `scaleway.containers.Trigger` resource allows you to create and manage triggers for Scaleway [Serverless Containers](https://www.scaleway.com/en/docs/serverless/containers/). * * Refer to the Containers triggers [documentation](https://www.scaleway.com/en/docs/serverless/containers/how-to/add-trigger-to-a-container/) and [API documentation](https://www.scaleway.com/en/developers/api/serverless-containers/#path-triggers-list-all-triggers) for more information. * * ## Example Usage * * ### SQS * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.containers.Trigger("main", { * containerId: mainScalewayContainer.id, * name: "my-sqs-trigger", * destinationConfig: { * httpPath: "/", * httpMethod: "get", * }, * sqs: { * endpoint: mainScalewayMnqSqsQueue.sqsEndpoint, * queueUrl: mainScalewayMnqSqsQueue.url, * accessKey: mainScalewayMnqSqsCredentials.accessKey, * secretKey: mainScalewayMnqSqsCredentials.secretKey, * region: mainScalewayMnqSqs.region, * }, * }); * ``` * * ### NATS * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.containers.Trigger("main", { * containerId: mainScalewayContainer.id, * name: "my-nats-trigger", * destinationConfig: { * httpPath: "/ping", * httpMethod: "get", * }, * nats: { * subject: "TestSubject", * serverUrls: [mainScalewayMnqNatsAccount.endpoint], * credentialsFileContent: mainScalewayMnqNatsCredentials.file, * region: mainScalewayMnqNatsAccount.region, * }, * }); * ``` * * ### Cron * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const main = new scaleway.containers.Trigger("main", { * containerId: mainScalewayContainer.id, * name: "my-cron-trigger", * destinationConfig: { * httpPath: "/patch/here", * httpMethod: "patch", * }, * cron: { * schedule: "5 4 1 * *", * timezone: "Europe/Paris", * body: "{\"message\": \"This is the content to send to the container.\"}", * headers: { * "Content-Length": "45", * "Content-Type": "application/json", * }, * }, * }); * ``` * * ## Import * * Container Triggers can be imported using `{region}/{id}`, as shown below: * * ```sh * $ pulumi import scaleway:containers/trigger:Trigger main fr-par/11111111-1111-1111-1111-111111111111 * ``` */ class Trigger extends pulumi.CustomResource { /** * Get an existing Trigger 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 Trigger(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'scaleway:containers/trigger:Trigger'; /** * Returns true if the given object is an instance of Trigger. 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'] === Trigger.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["containerId"] = state?.containerId; resourceInputs["cron"] = state?.cron; resourceInputs["description"] = state?.description; resourceInputs["destinationConfig"] = state?.destinationConfig; resourceInputs["name"] = state?.name; resourceInputs["nats"] = state?.nats; resourceInputs["region"] = state?.region; resourceInputs["sqs"] = state?.sqs; resourceInputs["tags"] = state?.tags; } else { const args = argsOrState; if (args?.containerId === undefined && !opts.urn) { throw new Error("Missing required property 'containerId'"); } if (args?.destinationConfig === undefined && !opts.urn) { throw new Error("Missing required property 'destinationConfig'"); } resourceInputs["containerId"] = args?.containerId; resourceInputs["cron"] = args?.cron; resourceInputs["description"] = args?.description; resourceInputs["destinationConfig"] = args?.destinationConfig; resourceInputs["name"] = args?.name; resourceInputs["nats"] = args?.nats; resourceInputs["region"] = args?.region; resourceInputs["sqs"] = args?.sqs; resourceInputs["tags"] = args?.tags; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const aliasOpts = { aliases: [{ type: "scaleway:index/containerTrigger:ContainerTrigger" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(Trigger.__pulumiType, name, resourceInputs, opts); } } exports.Trigger = Trigger; //# sourceMappingURL=trigger.js.map