// *** 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! *** import * as pulumi from "@pulumi/pulumi"; import * as utilities from "./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 * ``` */ export 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. */ public static get(name: string, id: pulumi.Input, state?: WebhookEndpointState, opts?: pulumi.CustomResourceOptions): WebhookEndpoint { return new WebhookEndpoint(name, state, { ...opts, id: id }); } /** @internal */ public static readonly __pulumiType = 'stripe:index/webhookEndpoint:WebhookEndpoint'; /** * 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. */ public static isInstance(obj: any): obj is WebhookEndpoint { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === WebhookEndpoint.__pulumiType; } /** * String. Events sent to this endpoint will be generated with this Stripe Version instead of your account’s default Stripe Version. */ public readonly apiVersion!: pulumi.Output; /** * String. The ID of the associated Connect application. */ public /*out*/ readonly application!: pulumi.Output; /** * Bool. Whether this endpoint should receive events from connected accounts (`true`), or from your account (`false`). Defaults to `false`. */ public readonly connect!: pulumi.Output; /** * String. Description of what the webhook is used for. */ public readonly description!: pulumi.Output; /** * Bool. Disable the webhook endpoint if set to `true`. Can be used only for modification already existing webhook endpoint. */ public readonly disabled!: pulumi.Output; /** * List(String). The list of events to enable for this endpoint. `[*]` indicates that all events are enabled, except those that require explicit selection. All supported events listed here: [Stripe event types](https://stripe.com/docs/api/events/types). */ public readonly enabledEvents!: pulumi.Output; /** * Map(String). Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. */ public readonly metadata!: pulumi.Output<{[key: string]: string} | undefined>; /** * String. The endpoint’s secret, used to generate webhook signatures. This field is marked as `sensitive`. */ public /*out*/ readonly secret!: pulumi.Output; /** * String. The URL of the webhook endpoint. */ public readonly url!: pulumi.Output; /** * Create a WebhookEndpoint 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: WebhookEndpointArgs, opts?: pulumi.CustomResourceOptions) constructor(name: string, argsOrState?: WebhookEndpointArgs | WebhookEndpointState, opts?: pulumi.CustomResourceOptions) { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState as WebhookEndpointState | undefined; resourceInputs["apiVersion"] = state ? state.apiVersion : undefined; resourceInputs["application"] = state ? state.application : 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 as WebhookEndpointArgs | undefined; 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["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); } } /** * Input properties used for looking up and filtering WebhookEndpoint resources. */ export interface WebhookEndpointState { /** * String. Events sent to this endpoint will be generated with this Stripe Version instead of your account’s default Stripe Version. */ apiVersion?: pulumi.Input; /** * String. The ID of the associated Connect application. */ application?: pulumi.Input; /** * Bool. Whether this endpoint should receive events from connected accounts (`true`), or from your account (`false`). Defaults to `false`. */ connect?: pulumi.Input; /** * String. Description of what the webhook is used for. */ description?: pulumi.Input; /** * Bool. Disable the webhook endpoint if set to `true`. Can be used only for modification already existing webhook endpoint. */ disabled?: pulumi.Input; /** * List(String). The list of events to enable for this endpoint. `[*]` indicates that all events are enabled, except those that require explicit selection. All supported events listed here: [Stripe event types](https://stripe.com/docs/api/events/types). */ enabledEvents?: pulumi.Input[]>; /** * Map(String). Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. */ metadata?: pulumi.Input<{[key: string]: pulumi.Input}>; /** * String. The endpoint’s secret, used to generate webhook signatures. This field is marked as `sensitive`. */ secret?: pulumi.Input; /** * String. The URL of the webhook endpoint. */ url?: pulumi.Input; } /** * The set of arguments for constructing a WebhookEndpoint resource. */ export interface WebhookEndpointArgs { /** * String. Events sent to this endpoint will be generated with this Stripe Version instead of your account’s default Stripe Version. */ apiVersion?: pulumi.Input; /** * Bool. Whether this endpoint should receive events from connected accounts (`true`), or from your account (`false`). Defaults to `false`. */ connect?: pulumi.Input; /** * String. Description of what the webhook is used for. */ description?: pulumi.Input; /** * Bool. Disable the webhook endpoint if set to `true`. Can be used only for modification already existing webhook endpoint. */ disabled?: pulumi.Input; /** * List(String). The list of events to enable for this endpoint. `[*]` indicates that all events are enabled, except those that require explicit selection. All supported events listed here: [Stripe event types](https://stripe.com/docs/api/events/types). */ enabledEvents: pulumi.Input[]>; /** * Map(String). Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. */ metadata?: pulumi.Input<{[key: string]: pulumi.Input}>; /** * String. The URL of the webhook endpoint. */ url: pulumi.Input; }