UNPKG

@statsig/pulumi-statsig

Version:

A Pulumi package for creating and managing Statsig resources.

362 lines (353 loc) 15.6 kB
// *** 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 inputs from "./types/input"; import * as outputs from "./types/output"; import * as utilities from "./utilities"; /** * This resource allows you to configure metrics for your Statsig project. * * To learn more about metrics, see [Metrics Documentation](https://docs.statsig.com/metrics/101) * * To learn more about the API powering this resource, see [Metrics API Documentation](https://docs.statsig.com/console-api/metrics) * * > Note: [Warehouse Native](https://docs.statsig.com/statsig-warehouse-native/introduction/) metrics can only be used in Warehouse Native projects */ export class Metric extends pulumi.CustomResource { /** * Get an existing Metric 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<pulumi.ID>, state?: MetricState, opts?: pulumi.CustomResourceOptions): Metric { return new Metric(name, <any>state, { ...opts, id: id }); } /** @internal */ public static readonly __pulumiType = 'statsig:index/metric:Metric'; /** * Returns true if the given object is an instance of Metric. 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 Metric { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Metric.__pulumiType; } /** * Custom time window end date in days since exposure. */ public readonly customRollUpEnd!: pulumi.Output<number>; /** * Custom time window start date in days since exposure. */ public readonly customRollUpStart!: pulumi.Output<number>; /** * A description of the new metric, providing context and purpose. */ public readonly description!: pulumi.Output<string>; /** * Indicates the desired change direction for the metric. Use "increase" for positive changes and "decrease" for negative changes. */ public readonly directionality!: pulumi.Output<string>; /** * Skips persisting the metric (used to validate that inputs are correct) */ public readonly dryRun!: pulumi.Output<boolean>; /** * Specifies whether to count events or distinct users for the funnel metric. */ public readonly funnelCountDistinct!: pulumi.Output<string>; /** * List of events used to create funnel metrics. */ public readonly funnelEventLists!: pulumi.Output<outputs.MetricFunnelEventList[]>; /** * Indicates whether the metric is permanent and should not be deleted. */ public readonly isPermanent!: pulumi.Output<boolean>; /** * Set to true to make the metric definition editable only from the Console API. */ public readonly isReadOnly!: pulumi.Output<boolean>; /** * Marks the metric as verified for internal trustworthiness. */ public readonly isVerified!: pulumi.Output<boolean>; /** * List of input metrics used to calculate the new metric for composite types. */ public readonly metricComponentMetrics!: pulumi.Output<outputs.MetricMetricComponentMetric[]>; /** * An array of event definitions used to compute the metric. */ public readonly metricEvents!: pulumi.Output<outputs.MetricMetricEvent[]>; /** * The name of the new metric, which identifies it within the system. */ public readonly name!: pulumi.Output<string>; /** * Time window for the metric rollup. Specify "custom" for a customized time window. */ public readonly rollupTimeWindow!: pulumi.Output<string>; /** * Tags associated with the metric for categorization and searchability. */ public readonly tags!: pulumi.Output<string[]>; /** * The team associated with the metric, applicable for enterprise environments. */ public readonly team!: pulumi.Output<string>; /** * The team ID associated with the metric, applicable for enterprise environments. */ public readonly teamId!: pulumi.Output<string>; /** * The type of the metric. Allowed values include sum, ratio, mean, event*count*sum, composite, composite*sum, undefined, funnel, user*warehouse. */ public readonly type!: pulumi.Output<string>; /** * Array of unit types associated with the metric, such as stableID or userID. */ public readonly unitTypes!: pulumi.Output<string[]>; /** * Defines warehouse native metrics for advanced configurations. */ public readonly warehouseNative!: pulumi.Output<outputs.MetricWarehouseNative>; /** * Create a Metric 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: MetricArgs, opts?: pulumi.CustomResourceOptions) constructor(name: string, argsOrState?: MetricArgs | MetricState, opts?: pulumi.CustomResourceOptions) { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState as MetricState | undefined; resourceInputs["customRollUpEnd"] = state ? state.customRollUpEnd : undefined; resourceInputs["customRollUpStart"] = state ? state.customRollUpStart : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["directionality"] = state ? state.directionality : undefined; resourceInputs["dryRun"] = state ? state.dryRun : undefined; resourceInputs["funnelCountDistinct"] = state ? state.funnelCountDistinct : undefined; resourceInputs["funnelEventLists"] = state ? state.funnelEventLists : undefined; resourceInputs["isPermanent"] = state ? state.isPermanent : undefined; resourceInputs["isReadOnly"] = state ? state.isReadOnly : undefined; resourceInputs["isVerified"] = state ? state.isVerified : undefined; resourceInputs["metricComponentMetrics"] = state ? state.metricComponentMetrics : undefined; resourceInputs["metricEvents"] = state ? state.metricEvents : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["rollupTimeWindow"] = state ? state.rollupTimeWindow : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["team"] = state ? state.team : undefined; resourceInputs["teamId"] = state ? state.teamId : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["unitTypes"] = state ? state.unitTypes : undefined; resourceInputs["warehouseNative"] = state ? state.warehouseNative : undefined; } else { const args = argsOrState as MetricArgs | undefined; if ((!args || args.type === undefined) && !opts.urn) { throw new Error("Missing required property 'type'"); } resourceInputs["customRollUpEnd"] = args ? args.customRollUpEnd : undefined; resourceInputs["customRollUpStart"] = args ? args.customRollUpStart : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["directionality"] = args ? args.directionality : undefined; resourceInputs["dryRun"] = args ? args.dryRun : undefined; resourceInputs["funnelCountDistinct"] = args ? args.funnelCountDistinct : undefined; resourceInputs["funnelEventLists"] = args ? args.funnelEventLists : undefined; resourceInputs["isPermanent"] = args ? args.isPermanent : undefined; resourceInputs["isReadOnly"] = args ? args.isReadOnly : undefined; resourceInputs["isVerified"] = args ? args.isVerified : undefined; resourceInputs["metricComponentMetrics"] = args ? args.metricComponentMetrics : undefined; resourceInputs["metricEvents"] = args ? args.metricEvents : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["rollupTimeWindow"] = args ? args.rollupTimeWindow : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["team"] = args ? args.team : undefined; resourceInputs["teamId"] = args ? args.teamId : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["unitTypes"] = args ? args.unitTypes : undefined; resourceInputs["warehouseNative"] = args ? args.warehouseNative : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Metric.__pulumiType, name, resourceInputs, opts); } } /** * Input properties used for looking up and filtering Metric resources. */ export interface MetricState { /** * Custom time window end date in days since exposure. */ customRollUpEnd?: pulumi.Input<number>; /** * Custom time window start date in days since exposure. */ customRollUpStart?: pulumi.Input<number>; /** * A description of the new metric, providing context and purpose. */ description?: pulumi.Input<string>; /** * Indicates the desired change direction for the metric. Use "increase" for positive changes and "decrease" for negative changes. */ directionality?: pulumi.Input<string>; /** * Skips persisting the metric (used to validate that inputs are correct) */ dryRun?: pulumi.Input<boolean>; /** * Specifies whether to count events or distinct users for the funnel metric. */ funnelCountDistinct?: pulumi.Input<string>; /** * List of events used to create funnel metrics. */ funnelEventLists?: pulumi.Input<pulumi.Input<inputs.MetricFunnelEventList>[]>; /** * Indicates whether the metric is permanent and should not be deleted. */ isPermanent?: pulumi.Input<boolean>; /** * Set to true to make the metric definition editable only from the Console API. */ isReadOnly?: pulumi.Input<boolean>; /** * Marks the metric as verified for internal trustworthiness. */ isVerified?: pulumi.Input<boolean>; /** * List of input metrics used to calculate the new metric for composite types. */ metricComponentMetrics?: pulumi.Input<pulumi.Input<inputs.MetricMetricComponentMetric>[]>; /** * An array of event definitions used to compute the metric. */ metricEvents?: pulumi.Input<pulumi.Input<inputs.MetricMetricEvent>[]>; /** * The name of the new metric, which identifies it within the system. */ name?: pulumi.Input<string>; /** * Time window for the metric rollup. Specify "custom" for a customized time window. */ rollupTimeWindow?: pulumi.Input<string>; /** * Tags associated with the metric for categorization and searchability. */ tags?: pulumi.Input<pulumi.Input<string>[]>; /** * The team associated with the metric, applicable for enterprise environments. */ team?: pulumi.Input<string>; /** * The team ID associated with the metric, applicable for enterprise environments. */ teamId?: pulumi.Input<string>; /** * The type of the metric. Allowed values include sum, ratio, mean, event*count*sum, composite, composite*sum, undefined, funnel, user*warehouse. */ type?: pulumi.Input<string>; /** * Array of unit types associated with the metric, such as stableID or userID. */ unitTypes?: pulumi.Input<pulumi.Input<string>[]>; /** * Defines warehouse native metrics for advanced configurations. */ warehouseNative?: pulumi.Input<inputs.MetricWarehouseNative>; } /** * The set of arguments for constructing a Metric resource. */ export interface MetricArgs { /** * Custom time window end date in days since exposure. */ customRollUpEnd?: pulumi.Input<number>; /** * Custom time window start date in days since exposure. */ customRollUpStart?: pulumi.Input<number>; /** * A description of the new metric, providing context and purpose. */ description?: pulumi.Input<string>; /** * Indicates the desired change direction for the metric. Use "increase" for positive changes and "decrease" for negative changes. */ directionality?: pulumi.Input<string>; /** * Skips persisting the metric (used to validate that inputs are correct) */ dryRun?: pulumi.Input<boolean>; /** * Specifies whether to count events or distinct users for the funnel metric. */ funnelCountDistinct?: pulumi.Input<string>; /** * List of events used to create funnel metrics. */ funnelEventLists?: pulumi.Input<pulumi.Input<inputs.MetricFunnelEventList>[]>; /** * Indicates whether the metric is permanent and should not be deleted. */ isPermanent?: pulumi.Input<boolean>; /** * Set to true to make the metric definition editable only from the Console API. */ isReadOnly?: pulumi.Input<boolean>; /** * Marks the metric as verified for internal trustworthiness. */ isVerified?: pulumi.Input<boolean>; /** * List of input metrics used to calculate the new metric for composite types. */ metricComponentMetrics?: pulumi.Input<pulumi.Input<inputs.MetricMetricComponentMetric>[]>; /** * An array of event definitions used to compute the metric. */ metricEvents?: pulumi.Input<pulumi.Input<inputs.MetricMetricEvent>[]>; /** * The name of the new metric, which identifies it within the system. */ name?: pulumi.Input<string>; /** * Time window for the metric rollup. Specify "custom" for a customized time window. */ rollupTimeWindow?: pulumi.Input<string>; /** * Tags associated with the metric for categorization and searchability. */ tags?: pulumi.Input<pulumi.Input<string>[]>; /** * The team associated with the metric, applicable for enterprise environments. */ team?: pulumi.Input<string>; /** * The team ID associated with the metric, applicable for enterprise environments. */ teamId?: pulumi.Input<string>; /** * The type of the metric. Allowed values include sum, ratio, mean, event*count*sum, composite, composite*sum, undefined, funnel, user*warehouse. */ type: pulumi.Input<string>; /** * Array of unit types associated with the metric, such as stableID or userID. */ unitTypes?: pulumi.Input<pulumi.Input<string>[]>; /** * Defines warehouse native metrics for advanced configurations. */ warehouseNative?: pulumi.Input<inputs.MetricWarehouseNative>; }