@pulumi/kong
Version:
A Pulumi package for creating and managing Kong resources.
84 lines • 3.48 kB
JavaScript
;
// *** 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.ConsumerKeyAuth = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* ## # kong.ConsumerKeyAuth
*
* Resource that allows you to configure the [Key Authentication](https://docs.konghq.com/hub/kong-inc/key-auth/) plugin for a consumer.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as kong from "@pulumi/kong";
*
* const myConsumer = new kong.Consumer("my_consumer", {
* username: "User1",
* customId: "123",
* });
* const keyAuthPlugin = new kong.Plugin("key_auth_plugin", {name: "key-auth"});
* const consumerKeyAuth = new kong.ConsumerKeyAuth("consumer_key_auth", {
* consumerId: myConsumer.id,
* key: "secret",
* tags: [
* "myTag",
* "anotherTag",
* ],
* });
* ```
*/
class ConsumerKeyAuth extends pulumi.CustomResource {
/**
* Get an existing ConsumerKeyAuth 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 ConsumerKeyAuth(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ConsumerKeyAuth. 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'] === ConsumerKeyAuth.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["consumerId"] = state ? state.consumerId : undefined;
resourceInputs["key"] = state ? state.key : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
}
else {
const args = argsOrState;
if ((!args || args.consumerId === undefined) && !opts.urn) {
throw new Error("Missing required property 'consumerId'");
}
resourceInputs["consumerId"] = args ? args.consumerId : undefined;
resourceInputs["key"] = (args === null || args === void 0 ? void 0 : args.key) ? pulumi.secret(args.key) : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["key"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(ConsumerKeyAuth.__pulumiType, name, resourceInputs, opts);
}
}
exports.ConsumerKeyAuth = ConsumerKeyAuth;
/** @internal */
ConsumerKeyAuth.__pulumiType = 'kong:index/consumerKeyAuth:ConsumerKeyAuth';
//# sourceMappingURL=consumerKeyAuth.js.map