pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
87 lines • 3.65 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.ProductFeature = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* With this resource, you can create Product Feature - [Stripe API product feature documentation](https://docs.stripe.com/api/product-feature)
*
* A Product Feature represents an attachment between a feature and a product.
* When a product is purchased that has a feature attached,
* Stripe will create an entitlement to the feature for the purchasing customer.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as stripe from "pulumi-stripe";
*
* // Product Feature attaches an Entitlement Feature to a Product
* const productFeature = new stripe.ProductFeature("productFeature", {
* entitlementsFeature: stripe_entitlements_feature.feature.id,
* product: stripe_product.product.id,
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import stripe:index/productFeature:ProductFeature product_feature <product_feature_id>
* ```
*/
class ProductFeature extends pulumi.CustomResource {
/**
* Get an existing ProductFeature 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 ProductFeature(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ProductFeature. 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'] === ProductFeature.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["entitlementsFeature"] = state?.entitlementsFeature;
resourceInputs["livemode"] = state?.livemode;
resourceInputs["object"] = state?.object;
resourceInputs["product"] = state?.product;
}
else {
const args = argsOrState;
if (args?.entitlementsFeature === undefined && !opts.urn) {
throw new Error("Missing required property 'entitlementsFeature'");
}
if (args?.product === undefined && !opts.urn) {
throw new Error("Missing required property 'product'");
}
resourceInputs["entitlementsFeature"] = args?.entitlementsFeature;
resourceInputs["product"] = args?.product;
resourceInputs["livemode"] = undefined /*out*/;
resourceInputs["object"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ProductFeature.__pulumiType, name, resourceInputs, opts);
}
}
exports.ProductFeature = ProductFeature;
/** @internal */
ProductFeature.__pulumiType = 'stripe:index/productFeature:ProductFeature';
//# sourceMappingURL=productFeature.js.map