UNPKG

@pulumi/kong

Version:

A Pulumi package for creating and managing Kong resources.

215 lines (214 loc) 7.23 kB
import * as pulumi from "@pulumi/pulumi"; /** * ## # kong.Plugin * * The plugin resource maps directly onto the json for the API endpoint in Kong. For more information on the parameters [see the Kong Api create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#plugin-object). * The `configJson` is passed through to the plugin to configure it as is. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as kong from "@pulumi/kong"; * * const rateLimit = new kong.Plugin("rate_limit", { * name: "rate-limiting", * configJson: `\x09{ * \x09\x09"second": 5, * \x09\x09"hour" : 1000 * \x09} * `, * }); * ``` * To apply a plugin to a consumer use the `consumerId` property, for example: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as kong from "@pulumi/kong"; * * const pluginConsumer = new kong.Consumer("plugin_consumer", { * username: "PluginUser", * customId: "567", * }); * const rateLimit = new kong.Plugin("rate_limit", { * name: "rate-limiting", * consumerId: pluginConsumer.id, * configJson: `\x09{ * \x09\x09"second": 5, * \x09\x09"hour" : 1000 * \x09} * `, * }); * ``` * * To apply a plugin to a service use the `serviceId` property, for example: * * ```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", * }); * const rateLimit = new kong.Plugin("rate_limit", { * name: "rate-limiting", * serviceId: service.id, * configJson: `\x09{ * \x09\x09"second": 10, * \x09\x09"hour" : 2000 * \x09} * `, * }); * ``` * * To apply a plugin to a route use the `routeId` property, for example: * * ```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", * }); * const rateLimit = new kong.Plugin("rate_limit", { * name: "rate-limiting", * enabled: true, * serviceId: service.id, * configJson: `\x09{ * \x09\x09"second": 11, * \x09\x09"hour" : 4000 * \x09} * `, * }); * ``` * * ## Import * * To import a plugin: * * ```sh * $ pulumi import kong:index/plugin:Plugin <plugin_identifier> <plugin_id> * ``` */ export declare class Plugin extends pulumi.CustomResource { /** * Get an existing Plugin 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: string, id: pulumi.Input<pulumi.ID>, state?: PluginState, opts?: pulumi.CustomResourceOptions): Plugin; /** * Returns true if the given object is an instance of Plugin. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Plugin; readonly computedConfig: pulumi.Output<string>; /** * this is the configuration json for how you want to configure the plugin. The json is passed straight through to kong as is. You can get the json config from the Kong documentation * page of the plugin you are configuring */ readonly configJson: pulumi.Output<string | undefined>; /** * the consumer id you want to configure the plugin for */ readonly consumerId: pulumi.Output<string | undefined>; /** * whether the plugin is enabled or not, use if you want to keep the plugin installed but disable it */ readonly enabled: pulumi.Output<boolean | undefined>; readonly name: pulumi.Output<string>; /** * the route id that you want to configure the plugin for */ readonly routeId: pulumi.Output<string | undefined>; /** * the service id that you want to configure the plugin for */ readonly serviceId: pulumi.Output<string | undefined>; readonly strictMatch: pulumi.Output<boolean | undefined>; /** * A list of strings associated with the Plugin for grouping and filtering */ readonly tags: pulumi.Output<string[] | undefined>; /** * Create a Plugin resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: PluginArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Plugin resources. */ export interface PluginState { computedConfig?: pulumi.Input<string>; /** * this is the configuration json for how you want to configure the plugin. The json is passed straight through to kong as is. You can get the json config from the Kong documentation * page of the plugin you are configuring */ configJson?: pulumi.Input<string>; /** * the consumer id you want to configure the plugin for */ consumerId?: pulumi.Input<string>; /** * whether the plugin is enabled or not, use if you want to keep the plugin installed but disable it */ enabled?: pulumi.Input<boolean>; name?: pulumi.Input<string>; /** * the route id that you want to configure the plugin for */ routeId?: pulumi.Input<string>; /** * the service id that you want to configure the plugin for */ serviceId?: pulumi.Input<string>; strictMatch?: pulumi.Input<boolean>; /** * A list of strings associated with the Plugin for grouping and filtering */ tags?: pulumi.Input<pulumi.Input<string>[]>; } /** * The set of arguments for constructing a Plugin resource. */ export interface PluginArgs { /** * this is the configuration json for how you want to configure the plugin. The json is passed straight through to kong as is. You can get the json config from the Kong documentation * page of the plugin you are configuring */ configJson?: pulumi.Input<string>; /** * the consumer id you want to configure the plugin for */ consumerId?: pulumi.Input<string>; /** * whether the plugin is enabled or not, use if you want to keep the plugin installed but disable it */ enabled?: pulumi.Input<boolean>; name?: pulumi.Input<string>; /** * the route id that you want to configure the plugin for */ routeId?: pulumi.Input<string>; /** * the service id that you want to configure the plugin for */ serviceId?: pulumi.Input<string>; strictMatch?: pulumi.Input<boolean>; /** * A list of strings associated with the Plugin for grouping and filtering */ tags?: pulumi.Input<pulumi.Input<string>[]>; }