@pulumi/kong
Version:
A Pulumi package for creating and managing Kong resources.
106 lines • 4.42 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.ConsumerOauth2 = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* ## # kong.ConsumerOauth2
*
* Resource that allows you to configure the OAuth2 plugin credentials 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 oauth2Plugin = new kong.Plugin("oauth2_plugin", {
* name: "oauth2",
* configJson: `\x09{
* \x09\x09"global_credentials": true,
* \x09\x09"enable_password_grant": true,
* \x09\x09"token_expiration": 180,
* \x09\x09"refresh_token_ttl": 180,
* \x09\x09"provision_key": "testprovisionkey"
* \x09}
* `,
* });
* const consumerOauth2 = new kong.ConsumerOauth2("consumer_oauth2", {
* name: "test_application",
* consumerId: myConsumer.id,
* clientId: "client_id",
* clientSecret: "client_secret",
* redirectUris: [
* "https://asdf.com/callback",
* "https://test.cl/callback",
* ],
* tags: ["myTag"],
* });
* ```
*/
class ConsumerOauth2 extends pulumi.CustomResource {
/**
* Get an existing ConsumerOauth2 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 ConsumerOauth2(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ConsumerOauth2. 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'] === ConsumerOauth2.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["clientId"] = state ? state.clientId : undefined;
resourceInputs["clientSecret"] = state ? state.clientSecret : undefined;
resourceInputs["consumerId"] = state ? state.consumerId : undefined;
resourceInputs["hashSecret"] = state ? state.hashSecret : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["redirectUris"] = state ? state.redirectUris : 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'");
}
if ((!args || args.redirectUris === undefined) && !opts.urn) {
throw new Error("Missing required property 'redirectUris'");
}
resourceInputs["clientId"] = args ? args.clientId : undefined;
resourceInputs["clientSecret"] = args ? args.clientSecret : undefined;
resourceInputs["consumerId"] = args ? args.consumerId : undefined;
resourceInputs["hashSecret"] = args ? args.hashSecret : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["redirectUris"] = args ? args.redirectUris : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ConsumerOauth2.__pulumiType, name, resourceInputs, opts);
}
}
exports.ConsumerOauth2 = ConsumerOauth2;
/** @internal */
ConsumerOauth2.__pulumiType = 'kong:index/consumerOauth2:ConsumerOauth2';
//# sourceMappingURL=consumerOauth2.js.map