pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
94 lines • 4.43 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.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
*
* <!--Start PulumiCodeChooser -->
* ```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",
* });
* ```
* <!--End PulumiCodeChooser -->
*/
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, Object.assign(Object.assign({}, 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 ? state.apiVersion : undefined;
resourceInputs["connect"] = state ? state.connect : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["disabled"] = state ? state.disabled : undefined;
resourceInputs["enabledEvents"] = state ? state.enabledEvents : undefined;
resourceInputs["metadata"] = state ? state.metadata : undefined;
resourceInputs["secret"] = state ? state.secret : undefined;
resourceInputs["url"] = state ? state.url : undefined;
}
else {
const args = argsOrState;
if ((!args || args.enabledEvents === undefined) && !opts.urn) {
throw new Error("Missing required property 'enabledEvents'");
}
if ((!args || args.url === undefined) && !opts.urn) {
throw new Error("Missing required property 'url'");
}
resourceInputs["apiVersion"] = args ? args.apiVersion : undefined;
resourceInputs["connect"] = args ? args.connect : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["disabled"] = args ? args.disabled : undefined;
resourceInputs["enabledEvents"] = args ? args.enabledEvents : undefined;
resourceInputs["metadata"] = args ? args.metadata : undefined;
resourceInputs["url"] = args ? args.url : undefined;
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