pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
115 lines • 4.66 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.TaxRate = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* With this resource, you can create a tax rate - [Stripe API tax rate documentation](https://stripe.com/docs/api/tax_rates).
*
* Tax rates can be applied to invoices, subscriptions and Checkout Sessions to collect tax.
*
* > Removal of the tax rate isn't supported through the Stripe API.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as stripe from "pulumi-stripe";
*
* const taxRate = new stripe.TaxRate("taxRate", {
* active: true,
* country: "AU",
* description: "GST Australia",
* displayName: "GST",
* inclusive: true,
* jurisdiction: "AU",
* metadata: {},
* percentage: 10,
* state: "",
* taxType: "",
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import stripe:index/taxRate:TaxRate rate <tax_rate_id>
* ```
*/
class TaxRate extends pulumi.CustomResource {
/**
* Get an existing TaxRate 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 TaxRate(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of TaxRate. 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'] === TaxRate.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["active"] = state?.active;
resourceInputs["country"] = state?.country;
resourceInputs["created"] = state?.created;
resourceInputs["description"] = state?.description;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["inclusive"] = state?.inclusive;
resourceInputs["jurisdiction"] = state?.jurisdiction;
resourceInputs["livemode"] = state?.livemode;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["object"] = state?.object;
resourceInputs["percentage"] = state?.percentage;
resourceInputs["state"] = state?.state;
resourceInputs["taxType"] = state?.taxType;
}
else {
const args = argsOrState;
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.inclusive === undefined && !opts.urn) {
throw new Error("Missing required property 'inclusive'");
}
if (args?.percentage === undefined && !opts.urn) {
throw new Error("Missing required property 'percentage'");
}
resourceInputs["active"] = args?.active;
resourceInputs["country"] = args?.country;
resourceInputs["description"] = args?.description;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["inclusive"] = args?.inclusive;
resourceInputs["jurisdiction"] = args?.jurisdiction;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["percentage"] = args?.percentage;
resourceInputs["state"] = args?.state;
resourceInputs["taxType"] = args?.taxType;
resourceInputs["created"] = undefined /*out*/;
resourceInputs["livemode"] = undefined /*out*/;
resourceInputs["object"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(TaxRate.__pulumiType, name, resourceInputs, opts);
}
}
exports.TaxRate = TaxRate;
/** @internal */
TaxRate.__pulumiType = 'stripe:index/taxRate:TaxRate';
//# sourceMappingURL=taxRate.js.map