@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
211 lines • 7.59 kB
JavaScript
;
// *** 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.IotRoute = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* > **Note:** This terraform resource is currently in beta and might include breaking change in future releases.
*
* Creates and manages Scaleway IoT Routes. For more information, see the following:
*
* - [API documentation](https://www.scaleway.com/en/developers/api/iot/).
* - [Product documentation](https://www.scaleway.com/en/docs/iot-hub/how-to/create-route/)
*
* ## 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(
* \\tpush_time,
* \\treport_time,
* \\tstation_id,
* \\ttemperature,
* \\thumidity
* ) VALUES (
* \\tNOW(),
* \\tTIMESTAMP 'epoch' + ((PAYLOAD::jsonb->'last_reported')::integer * INTERVAL '1 second'),
* \\t(PAYLOAD::jsonb->'station_id')::uuid,
* \\t(PAYLOAD::jsonb->'temperature')::decimal,
* \\t(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.
*
* ```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, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'scaleway:index/iotRoute:IotRoute';
/**
* 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?.createdAt;
resourceInputs["database"] = state?.database;
resourceInputs["hubId"] = state?.hubId;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
resourceInputs["rest"] = state?.rest;
resourceInputs["s3"] = state?.s3;
resourceInputs["topic"] = state?.topic;
}
else {
const args = argsOrState;
if (args?.hubId === undefined && !opts.urn) {
throw new Error("Missing required property 'hubId'");
}
if (args?.topic === undefined && !opts.urn) {
throw new Error("Missing required property 'topic'");
}
resourceInputs["database"] = args?.database;
resourceInputs["hubId"] = args?.hubId;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
resourceInputs["rest"] = args?.rest;
resourceInputs["s3"] = args?.s3;
resourceInputs["topic"] = args?.topic;
resourceInputs["createdAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(IotRoute.__pulumiType, name, resourceInputs, opts);
}
}
exports.IotRoute = IotRoute;
//# sourceMappingURL=iotRoute.js.map