@statsig/pulumi-statsig
Version:
A Pulumi package for creating and managing Statsig resources.
100 lines • 4.5 kB
JavaScript
;
// *** 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Keys = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./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 "@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"],
* });
* ```
*/
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.
*/
static get(name, id, state, opts) {
return new Keys(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Keys.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
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;
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);
}
}
exports.Keys = Keys;
/** @internal */
Keys.__pulumiType = 'statsig:index/keys:Keys';
//# sourceMappingURL=keys.js.map