pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
155 lines (154 loc) • 5.96 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* With this resource, you can create a billing meter - [Stripe API billing meter documentation](https://docs.stripe.com/api/billing/meter).
*
* A billing meter is a resource that allows you to track usage of a particular event. For example, you might create a billing meter to track the number of API calls made by a particular user. You can then attach the billing meter to a price and attach the price to a subscription to charge the user for the number of API calls they make.
*
* Related guide: [Usage based billing](https://docs.stripe.com/billing/subscriptions/usage-based)
*
* > Removal of the Billing Meter isn't supported through the Stripe API.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as stripe from "pulumi-stripe";
*
* // meter
* const sampleMeter = new stripe.Meter("sampleMeter", {
* customerMapping: {
* eventPayloadKey: "stripe_customer_id",
* type: "by_id",
* },
* defaultAggregation: {
* formula: "sum",
* },
* displayName: "A Sample meter",
* eventName: "sample_meter",
* valueSettings: {
* eventPayloadKey: "value",
* },
* });
* ```
*
* ## Note on updating meters
*
* Once created, you can update the `displayName`.
*
* Other attribute edits will trigger a destroy action (archival) and creation of a new meter entry.
*
* ## Import
*
* ```sh
* $ pulumi import stripe:index/meter:Meter meter <meter_id>
* ```
*/
export declare class Meter extends pulumi.CustomResource {
/**
* Get an existing Meter 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: string, id: pulumi.Input<pulumi.ID>, state?: MeterState, opts?: pulumi.CustomResourceOptions): Meter;
/**
* Returns true if the given object is an instance of Meter. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Meter;
/**
* Lst(Resource). Fields that specify how to map a meter event to a customer.
*/
readonly customerMapping: pulumi.Output<outputs.MeterCustomerMapping | undefined>;
/**
* List(Resource). The default settings to aggregate a meter’s events with.
*/
readonly defaultAggregation: pulumi.Output<outputs.MeterDefaultAggregation>;
/**
* String. The display name of the meter.
*/
readonly displayName: pulumi.Output<string>;
/**
* String. The name of the meter event to record usage for. Corresponds with the `eventName` field on meter events.
*/
readonly eventName: pulumi.Output<string>;
/**
* String. The time window to pre-aggregate meter events for, if any. Possible values are:
*/
readonly eventTimeWindow: pulumi.Output<string | undefined>;
/**
* List(Resource). Fields that specify how to calculate a meter event’s value.
*/
readonly valueSettings: pulumi.Output<outputs.MeterValueSettings | undefined>;
/**
* Create a Meter 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: MeterArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Meter resources.
*/
export interface MeterState {
/**
* Lst(Resource). Fields that specify how to map a meter event to a customer.
*/
customerMapping?: pulumi.Input<inputs.MeterCustomerMapping>;
/**
* List(Resource). The default settings to aggregate a meter’s events with.
*/
defaultAggregation?: pulumi.Input<inputs.MeterDefaultAggregation>;
/**
* String. The display name of the meter.
*/
displayName?: pulumi.Input<string>;
/**
* String. The name of the meter event to record usage for. Corresponds with the `eventName` field on meter events.
*/
eventName?: pulumi.Input<string>;
/**
* String. The time window to pre-aggregate meter events for, if any. Possible values are:
*/
eventTimeWindow?: pulumi.Input<string>;
/**
* List(Resource). Fields that specify how to calculate a meter event’s value.
*/
valueSettings?: pulumi.Input<inputs.MeterValueSettings>;
}
/**
* The set of arguments for constructing a Meter resource.
*/
export interface MeterArgs {
/**
* Lst(Resource). Fields that specify how to map a meter event to a customer.
*/
customerMapping?: pulumi.Input<inputs.MeterCustomerMapping>;
/**
* List(Resource). The default settings to aggregate a meter’s events with.
*/
defaultAggregation: pulumi.Input<inputs.MeterDefaultAggregation>;
/**
* String. The display name of the meter.
*/
displayName: pulumi.Input<string>;
/**
* String. The name of the meter event to record usage for. Corresponds with the `eventName` field on meter events.
*/
eventName: pulumi.Input<string>;
/**
* String. The time window to pre-aggregate meter events for, if any. Possible values are:
*/
eventTimeWindow?: pulumi.Input<string>;
/**
* List(Resource). Fields that specify how to calculate a meter event’s value.
*/
valueSettings?: pulumi.Input<inputs.MeterValueSettings>;
}