pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
100 lines • 4.27 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.WebhookEndpoint = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* With this resource, you can create a webhook endpoint - [Stripe API webhook endpoint documentation](https://stripe.com/docs/api/webhook_endpoints).
*
* You can configure webhook endpoints via the API to be notified about events that happen in your Stripe account or connected accounts.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as stripe from "pulumi-stripe";
*
* const webhook = new stripe.WebhookEndpoint("webhook", {
* description: "example of webhook",
* enabledEvents: [
* "customer.subscription.created",
* "customer.subscription.updated",
* ],
* url: "https://webhook-url-consumer.com",
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import stripe:index/webhookEndpoint:WebhookEndpoint webhook <webhook_endpoint_id>
* ```
*/
class WebhookEndpoint extends pulumi.CustomResource {
/**
* Get an existing WebhookEndpoint 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 WebhookEndpoint(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of WebhookEndpoint. 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'] === WebhookEndpoint.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["apiVersion"] = state?.apiVersion;
resourceInputs["application"] = state?.application;
resourceInputs["connect"] = state?.connect;
resourceInputs["description"] = state?.description;
resourceInputs["disabled"] = state?.disabled;
resourceInputs["enabledEvents"] = state?.enabledEvents;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["secret"] = state?.secret;
resourceInputs["url"] = state?.url;
}
else {
const args = argsOrState;
if (args?.enabledEvents === undefined && !opts.urn) {
throw new Error("Missing required property 'enabledEvents'");
}
if (args?.url === undefined && !opts.urn) {
throw new Error("Missing required property 'url'");
}
resourceInputs["apiVersion"] = args?.apiVersion;
resourceInputs["connect"] = args?.connect;
resourceInputs["description"] = args?.description;
resourceInputs["disabled"] = args?.disabled;
resourceInputs["enabledEvents"] = args?.enabledEvents;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["url"] = args?.url;
resourceInputs["application"] = undefined /*out*/;
resourceInputs["secret"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["secret"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(WebhookEndpoint.__pulumiType, name, resourceInputs, opts);
}
}
exports.WebhookEndpoint = WebhookEndpoint;
/** @internal */
WebhookEndpoint.__pulumiType = 'stripe:index/webhookEndpoint:WebhookEndpoint';
//# sourceMappingURL=webhookEndpoint.js.map