UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

183 lines 6.52 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.IotRoute = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## Example Usage * * ### Database Route * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const mainHub = new scaleway.iot.Hub("main", { * name: "main", * productPlan: "plan_shared", * }); * const iot = new scaleway.databases.Instance("iot", { * name: "iot", * nodeType: "db-dev-s", * engine: "PostgreSQL-12", * userName: "root", * password: "T3stP4ssw0rdD0N0tUs3!", * }); * const main = new scaleway.iot.Route("main", { * name: "default", * hubId: mainHub.id, * topic: "#", * database: { * query: `INSERT INTO measurements( * \x09push_time, * \x09report_time, * \x09station_id, * \x09temperature, * \x09humidity * ) VALUES ( * \x09NOW(), * \x09TIMESTAMP 'epoch' + ((PAYLOAD::jsonb->'last_reported')::integer * INTERVAL '1 second'), * \x09(PAYLOAD::jsonb->'station_id')::uuid, * \x09(PAYLOAD::jsonb->'temperature')::decimal, * \x09(PAYLOAD::jsonb->'humidity'):decimal: * ); * `, * host: iot.endpointIp, * port: iot.endpointPort, * dbname: "rdb", * username: iot.userName, * password: iot.password, * }, * }); * ``` * * ### S3 Route * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const mainHub = new scaleway.iot.Hub("main", { * name: "main", * productPlan: "plan_shared", * }); * const mainBucket = new scaleway.object.Bucket("main", { * region: "fr-par", * name: "my_awesome-bucket", * }); * const main = new scaleway.iot.Route("main", { * name: "main", * hubId: mainHub.id, * topic: "#", * s3: { * bucketRegion: mainBucket.region, * bucketName: mainBucket.name, * objectPrefix: "foo", * strategy: "per_topic", * }, * }); * ``` * * ### Rest Route * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const mainHub = new scaleway.iot.Hub("main", { * name: "main", * productPlan: "plan_shared", * }); * const main = new scaleway.iot.Route("main", { * name: "main", * hubId: mainHub.id, * topic: "#", * rest: { * verb: "get", * uri: "http://scaleway.com", * headers: { * "X-awesome-header": "my-awesome-value", * }, * }, * }); * ``` * * ## Import * * IoT Routes can be imported using the `{region}/{id}`, e.g. * * bash * * ```sh * $ pulumi import scaleway:index/iotRoute:IotRoute route01 fr-par/11111111-1111-1111-1111-111111111111 * ``` * * @deprecated scaleway.index/iotroute.IotRoute has been deprecated in favor of scaleway.iot/route.Route */ class IotRoute extends pulumi.CustomResource { /** * Get an existing IotRoute 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("IotRoute is deprecated: scaleway.index/iotroute.IotRoute has been deprecated in favor of scaleway.iot/route.Route"); return new IotRoute(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of IotRoute. 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'] === IotRoute.__pulumiType; } /** @deprecated scaleway.index/iotroute.IotRoute has been deprecated in favor of scaleway.iot/route.Route */ constructor(name, argsOrState, opts) { pulumi.log.warn("IotRoute is deprecated: scaleway.index/iotroute.IotRoute has been deprecated in favor of scaleway.iot/route.Route"); let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["database"] = state ? state.database : undefined; resourceInputs["hubId"] = state ? state.hubId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["rest"] = state ? state.rest : undefined; resourceInputs["s3"] = state ? state.s3 : undefined; resourceInputs["topic"] = state ? state.topic : undefined; } else { const args = argsOrState; if ((!args || args.hubId === undefined) && !opts.urn) { throw new Error("Missing required property 'hubId'"); } if ((!args || args.topic === undefined) && !opts.urn) { throw new Error("Missing required property 'topic'"); } resourceInputs["database"] = args ? args.database : undefined; resourceInputs["hubId"] = args ? args.hubId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["rest"] = args ? args.rest : undefined; resourceInputs["s3"] = args ? args.s3 : undefined; resourceInputs["topic"] = args ? args.topic : undefined; resourceInputs["createdAt"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(IotRoute.__pulumiType, name, resourceInputs, opts); } } exports.IotRoute = IotRoute; /** @internal */ IotRoute.__pulumiType = 'scaleway:index/iotRoute:IotRoute'; //# sourceMappingURL=iotRoute.js.map