UNPKG

@statsig/pulumi-statsig

Version:

A Pulumi package for creating and managing Statsig resources.

142 lines (133 loc) 6.24 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 utilities from "./utilities"; /** * This resource allows you to configure API keys for your Statsig project. * * To learn more about API keys, see [API Keys Documentation](https://docs.statsig.com/sdk-keys/api-keys/) * * To learn more about the API powering this resource, see [Keys API Documentation](https://docs.statsig.com/console-api/keys) * * > Note: This resource requires a Console API Key with the following scope: `can access other keys` * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as statsig from "@statsig/pulumi-statsig"; * * const serverKey = new statsig.Keys("server_key", { * description: "A short description of what this server key is used for.", * type: "SERVER", * environments: ["production"], * }); * const clientKey = new statsig.Keys("client_key", { * description: "A short description of what this client key is used for.", * type: "CLIENT", * environments: ["production"], * scopes: ["client_download_config_specs"], * }); * const consoleKey = new statsig.Keys("console_key", { * description: "A short description of what this console key is used for.", * type: "CONSOLE", * scopes: ["omni_read_only"], * }); * ``` */ export class Keys extends pulumi.CustomResource { /** * Get an existing Keys 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?: KeysState, opts?: pulumi.CustomResourceOptions): Keys { return new Keys(name, <any>state, { ...opts, id: id }); } /** @internal */ public static readonly __pulumiType = 'statsig:index/keys:Keys'; /** * Returns true if the given object is an instance of Keys. 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 Keys { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Keys.__pulumiType; } public readonly description!: pulumi.Output<string>; public readonly environments!: pulumi.Output<string[]>; public readonly key!: pulumi.Output<string>; public readonly scopes!: pulumi.Output<string[]>; public readonly secondaryTargetAppIds!: pulumi.Output<string[]>; public readonly targetAppId!: pulumi.Output<string>; public readonly type!: pulumi.Output<string>; /** * Create a Keys 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: KeysArgs, opts?: pulumi.CustomResourceOptions) constructor(name: string, argsOrState?: KeysArgs | KeysState, opts?: pulumi.CustomResourceOptions) { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState as KeysState | undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["environments"] = state ? state.environments : undefined; resourceInputs["key"] = state ? state.key : undefined; resourceInputs["scopes"] = state ? state.scopes : undefined; resourceInputs["secondaryTargetAppIds"] = state ? state.secondaryTargetAppIds : undefined; resourceInputs["targetAppId"] = state ? state.targetAppId : undefined; resourceInputs["type"] = state ? state.type : undefined; } else { const args = argsOrState as KeysArgs | undefined; if ((!args || args.description === undefined) && !opts.urn) { throw new Error("Missing required property 'description'"); } if ((!args || args.type === undefined) && !opts.urn) { throw new Error("Missing required property 'type'"); } resourceInputs["description"] = args ? args.description : undefined; resourceInputs["environments"] = args ? args.environments : undefined; resourceInputs["key"] = args ? args.key : undefined; resourceInputs["scopes"] = args ? args.scopes : undefined; resourceInputs["secondaryTargetAppIds"] = args ? args.secondaryTargetAppIds : undefined; resourceInputs["targetAppId"] = args ? args.targetAppId : undefined; resourceInputs["type"] = args ? args.type : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Keys.__pulumiType, name, resourceInputs, opts); } } /** * Input properties used for looking up and filtering Keys resources. */ export interface KeysState { description?: pulumi.Input<string>; environments?: pulumi.Input<pulumi.Input<string>[]>; key?: pulumi.Input<string>; scopes?: pulumi.Input<pulumi.Input<string>[]>; secondaryTargetAppIds?: pulumi.Input<pulumi.Input<string>[]>; targetAppId?: pulumi.Input<string>; type?: pulumi.Input<string>; } /** * The set of arguments for constructing a Keys resource. */ export interface KeysArgs { description: pulumi.Input<string>; environments?: pulumi.Input<pulumi.Input<string>[]>; key?: pulumi.Input<string>; scopes?: pulumi.Input<pulumi.Input<string>[]>; secondaryTargetAppIds?: pulumi.Input<pulumi.Input<string>[]>; targetAppId?: pulumi.Input<string>; type: pulumi.Input<string>; }