UNPKG

@pulumi/kong

Version:

A Pulumi package for creating and managing Kong resources.

187 lines 7.33 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.Route = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("./utilities")); /** * ## # kong.Route * * The route resource maps directly onto the json for the route endpoint in Kong. For more information on the parameters [see the Kong Route create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#route-object). * * To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as kong from "@pulumi/kong"; * * const route = new kong.Route("route", { * name: "MyRoute", * protocols: [ * "http", * "https", * ], * methods: [ * "GET", * "POST", * ], * hosts: ["example2.com"], * paths: ["/test"], * stripPath: false, * preserveHost: true, * regexPriority: 1, * serviceId: service.id, * headers: [{ * name: "x-test-1", * values: [ * "a", * "b", * ], * }], * }); * ``` * * To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want, for example: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as kong from "@pulumi/kong"; * * const route = new kong.Route("route", { * protocols: ["tcp"], * stripPath: true, * preserveHost: false, * sources: [ * { * ip: "192.168.1.1", * port: 80, * }, * { * ip: "192.168.1.2", * }, * ], * destinations: [{ * ip: "172.10.1.1", * port: 81, * }], * snis: ["foo.com"], * serviceId: service.id, * }); * ``` * * ## Import * * To import a route: * * ```sh * $ pulumi import kong:index/route:Route <route_identifier> <route_id> * ``` */ class Route extends pulumi.CustomResource { /** * Get an existing Route 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 Route(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'kong:index/route:Route'; /** * Returns true if the given object is an instance of Route. 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'] === Route.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["destinations"] = state?.destinations; resourceInputs["headers"] = state?.headers; resourceInputs["hosts"] = state?.hosts; resourceInputs["httpsRedirectStatusCode"] = state?.httpsRedirectStatusCode; resourceInputs["methods"] = state?.methods; resourceInputs["name"] = state?.name; resourceInputs["pathHandling"] = state?.pathHandling; resourceInputs["paths"] = state?.paths; resourceInputs["preserveHost"] = state?.preserveHost; resourceInputs["protocols"] = state?.protocols; resourceInputs["regexPriority"] = state?.regexPriority; resourceInputs["requestBuffering"] = state?.requestBuffering; resourceInputs["responseBuffering"] = state?.responseBuffering; resourceInputs["serviceId"] = state?.serviceId; resourceInputs["snis"] = state?.snis; resourceInputs["sources"] = state?.sources; resourceInputs["stripPath"] = state?.stripPath; resourceInputs["tags"] = state?.tags; } else { const args = argsOrState; if (args?.protocols === undefined && !opts.urn) { throw new Error("Missing required property 'protocols'"); } if (args?.serviceId === undefined && !opts.urn) { throw new Error("Missing required property 'serviceId'"); } resourceInputs["destinations"] = args?.destinations; resourceInputs["headers"] = args?.headers; resourceInputs["hosts"] = args?.hosts; resourceInputs["httpsRedirectStatusCode"] = args?.httpsRedirectStatusCode; resourceInputs["methods"] = args?.methods; resourceInputs["name"] = args?.name; resourceInputs["pathHandling"] = args?.pathHandling; resourceInputs["paths"] = args?.paths; resourceInputs["preserveHost"] = args?.preserveHost; resourceInputs["protocols"] = args?.protocols; resourceInputs["regexPriority"] = args?.regexPriority; resourceInputs["requestBuffering"] = args?.requestBuffering; resourceInputs["responseBuffering"] = args?.responseBuffering; resourceInputs["serviceId"] = args?.serviceId; resourceInputs["snis"] = args?.snis; resourceInputs["sources"] = args?.sources; resourceInputs["stripPath"] = args?.stripPath; resourceInputs["tags"] = args?.tags; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Route.__pulumiType, name, resourceInputs, opts); } } exports.Route = Route; //# sourceMappingURL=route.js.map