@pulumi/kong
Version:
A Pulumi package for creating and managing Kong resources.
149 lines • 6.13 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Service = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.caCertificateIds : undefined;
resourceInputs["clientCertificateId"] = state ? state.clientCertificateId : undefined;
resourceInputs["connectTimeout"] = state ? state.connectTimeout : undefined;
resourceInputs["host"] = state ? state.host : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["path"] = state ? state.path : undefined;
resourceInputs["port"] = state ? state.port : undefined;
resourceInputs["protocol"] = state ? state.protocol : undefined;
resourceInputs["readTimeout"] = state ? state.readTimeout : undefined;
resourceInputs["retries"] = state ? state.retries : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tlsVerify"] = state ? state.tlsVerify : undefined;
resourceInputs["tlsVerifyDepth"] = state ? state.tlsVerifyDepth : undefined;
resourceInputs["writeTimeout"] = state ? state.writeTimeout : undefined;
}
else {
const args = argsOrState;
if ((!args || args.protocol === undefined) && !opts.urn) {
throw new Error("Missing required property 'protocol'");
}
resourceInputs["caCertificateIds"] = args ? args.caCertificateIds : undefined;
resourceInputs["clientCertificateId"] = args ? args.clientCertificateId : undefined;
resourceInputs["connectTimeout"] = args ? args.connectTimeout : undefined;
resourceInputs["host"] = args ? args.host : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["path"] = args ? args.path : undefined;
resourceInputs["port"] = args ? args.port : undefined;
resourceInputs["protocol"] = args ? args.protocol : undefined;
resourceInputs["readTimeout"] = args ? args.readTimeout : undefined;
resourceInputs["retries"] = args ? args.retries : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["tlsVerify"] = args ? args.tlsVerify : undefined;
resourceInputs["tlsVerifyDepth"] = args ? args.tlsVerifyDepth : undefined;
resourceInputs["writeTimeout"] = args ? args.writeTimeout : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Service.__pulumiType, name, resourceInputs, opts);
}
}
exports.Service = Service;
/** @internal */
Service.__pulumiType = 'kong:index/service:Service';
//# sourceMappingURL=service.js.map