UNPKG

@pulumi/kong

Version:

A Pulumi package for creating and managing Kong resources.

172 lines 6.63 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.Service = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("./utilities")); /** * ## # kong.Service * * The service resource maps directly onto the json for the service endpoint in Kong. For more information on the parameters [see the Kong Service create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#service-object). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as kong from "@pulumi/kong"; * * const service = new kong.Service("service", { * name: "test", * protocol: "http", * host: "test.org", * port: 8080, * path: "/mypath", * retries: 5, * connectTimeout: 1000, * writeTimeout: 2000, * readTimeout: 3000, * }); * ``` * * To use a client certificate and ca certificates combine with certificate resource (note protocol must be `https`): * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as kong from "@pulumi/kong"; * * const certificate = new kong.Certificate("certificate", { * certificate: ` -----BEGIN CERTIFICATE----- * ...... * -----END CERTIFICATE----- * `, * privateKey: ` -----BEGIN PRIVATE KEY----- * ..... * -----END PRIVATE KEY----- * `, * snis: ["foo.com"], * }); * const ca = new kong.Certificate("ca", { * certificate: ` -----BEGIN CERTIFICATE----- * ...... * -----END CERTIFICATE----- * `, * privateKey: ` -----BEGIN PRIVATE KEY----- * ..... * -----END PRIVATE KEY----- * `, * snis: ["ca.com"], * }); * const service = new kong.Service("service", { * name: "test", * protocol: "https", * host: "test.org", * tlsVerify: true, * tlsVerifyDepth: 2, * clientCertificateId: certificate.id, * caCertificateIds: [ca.id], * }); * ``` * * ## Import * * To import a service: * * ```sh * $ pulumi import kong:index/service:Service <service_identifier> <service_id> * ``` */ class Service extends pulumi.CustomResource { /** * Get an existing Service 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 Service(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'kong:index/service:Service'; /** * Returns true if the given object is an instance of Service. 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'] === Service.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["caCertificateIds"] = state?.caCertificateIds; resourceInputs["clientCertificateId"] = state?.clientCertificateId; resourceInputs["connectTimeout"] = state?.connectTimeout; resourceInputs["host"] = state?.host; resourceInputs["name"] = state?.name; resourceInputs["path"] = state?.path; resourceInputs["port"] = state?.port; resourceInputs["protocol"] = state?.protocol; resourceInputs["readTimeout"] = state?.readTimeout; resourceInputs["retries"] = state?.retries; resourceInputs["tags"] = state?.tags; resourceInputs["tlsVerify"] = state?.tlsVerify; resourceInputs["tlsVerifyDepth"] = state?.tlsVerifyDepth; resourceInputs["writeTimeout"] = state?.writeTimeout; } else { const args = argsOrState; if (args?.protocol === undefined && !opts.urn) { throw new Error("Missing required property 'protocol'"); } resourceInputs["caCertificateIds"] = args?.caCertificateIds; resourceInputs["clientCertificateId"] = args?.clientCertificateId; resourceInputs["connectTimeout"] = args?.connectTimeout; resourceInputs["host"] = args?.host; resourceInputs["name"] = args?.name; resourceInputs["path"] = args?.path; resourceInputs["port"] = args?.port; resourceInputs["protocol"] = args?.protocol; resourceInputs["readTimeout"] = args?.readTimeout; resourceInputs["retries"] = args?.retries; resourceInputs["tags"] = args?.tags; resourceInputs["tlsVerify"] = args?.tlsVerify; resourceInputs["tlsVerifyDepth"] = args?.tlsVerifyDepth; resourceInputs["writeTimeout"] = args?.writeTimeout; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Service.__pulumiType, name, resourceInputs, opts); } } exports.Service = Service; //# sourceMappingURL=service.js.map