UNPKG

@lbrlabs/pulumi-scaleway

Version:

A Pulumi package for creating and managing scaleway cloud resources.

132 lines 6.91 kB
"use strict"; // *** 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.Function = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Creates and manages Scaleway Functions. * For more information see [the documentation](https://developers.scaleway.com/en/products/functions/api/). * * ## Examples * * ### Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@lbrlabs/pulumi-scaleway"; * * const mainFunctionNamespace = new scaleway.FunctionNamespace("mainFunctionNamespace", {description: "Main function namespace"}); * const mainFunction = new scaleway.Function("mainFunction", { * namespaceId: mainFunctionNamespace.id, * runtime: "go118", * handler: "Handle", * privacy: "private", * }); * ``` * * ## Import * * Functions can be imported using the `{region}/{id}`, e.g. bash * * ```sh * $ pulumi import scaleway:index/function:Function main fr-par/11111111-1111-1111-1111-111111111111 * ``` */ class Function extends pulumi.CustomResource { /** * Get an existing Function 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 Function(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Function. 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'] === Function.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["cpuLimit"] = state ? state.cpuLimit : undefined; resourceInputs["deploy"] = state ? state.deploy : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["domainName"] = state ? state.domainName : undefined; resourceInputs["environmentVariables"] = state ? state.environmentVariables : undefined; resourceInputs["handler"] = state ? state.handler : undefined; resourceInputs["httpOption"] = state ? state.httpOption : undefined; resourceInputs["maxScale"] = state ? state.maxScale : undefined; resourceInputs["memoryLimit"] = state ? state.memoryLimit : undefined; resourceInputs["minScale"] = state ? state.minScale : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["namespaceId"] = state ? state.namespaceId : undefined; resourceInputs["organizationId"] = state ? state.organizationId : undefined; resourceInputs["privacy"] = state ? state.privacy : undefined; resourceInputs["projectId"] = state ? state.projectId : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["runtime"] = state ? state.runtime : undefined; resourceInputs["secretEnvironmentVariables"] = state ? state.secretEnvironmentVariables : undefined; resourceInputs["timeout"] = state ? state.timeout : undefined; resourceInputs["zipFile"] = state ? state.zipFile : undefined; resourceInputs["zipHash"] = state ? state.zipHash : undefined; } else { const args = argsOrState; if ((!args || args.handler === undefined) && !opts.urn) { throw new Error("Missing required property 'handler'"); } if ((!args || args.namespaceId === undefined) && !opts.urn) { throw new Error("Missing required property 'namespaceId'"); } if ((!args || args.privacy === undefined) && !opts.urn) { throw new Error("Missing required property 'privacy'"); } if ((!args || args.runtime === undefined) && !opts.urn) { throw new Error("Missing required property 'runtime'"); } resourceInputs["deploy"] = args ? args.deploy : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["environmentVariables"] = args ? args.environmentVariables : undefined; resourceInputs["handler"] = args ? args.handler : undefined; resourceInputs["httpOption"] = args ? args.httpOption : undefined; resourceInputs["maxScale"] = args ? args.maxScale : undefined; resourceInputs["memoryLimit"] = args ? args.memoryLimit : undefined; resourceInputs["minScale"] = args ? args.minScale : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["namespaceId"] = args ? args.namespaceId : undefined; resourceInputs["privacy"] = args ? args.privacy : undefined; resourceInputs["projectId"] = args ? args.projectId : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["runtime"] = args ? args.runtime : undefined; resourceInputs["secretEnvironmentVariables"] = (args === null || args === void 0 ? void 0 : args.secretEnvironmentVariables) ? pulumi.secret(args.secretEnvironmentVariables) : undefined; resourceInputs["timeout"] = args ? args.timeout : undefined; resourceInputs["zipFile"] = args ? args.zipFile : undefined; resourceInputs["zipHash"] = args ? args.zipHash : undefined; resourceInputs["cpuLimit"] = undefined /*out*/; resourceInputs["domainName"] = undefined /*out*/; resourceInputs["organizationId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["secretEnvironmentVariables"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Function.__pulumiType, name, resourceInputs, opts); } } exports.Function = Function; /** @internal */ Function.__pulumiType = 'scaleway:index/function:Function'; //# sourceMappingURL=function.js.map