UNPKG

@lbrlabs/pulumi-harness

Version:

A Pulumi package for creating and managing Harness resources.

160 lines 6.96 kB
"use strict"; // *** 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.FeatureFlag = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Resource for managing Feature Flags. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as harness from "@lbrlabs/pulumi-harness"; * * // Boolean Flag * const mybooleanflag = new harness.platform.FeatureFlag("mybooleanflag", { * defaultOffVariation: "Disabled", * defaultOnVariation: "Enabled", * identifier: "MY_FEATURE", * kind: "boolean", * orgId: "test", * permanent: false, * projectId: "testff", * variations: [ * { * description: "The feature is enabled", * identifier: "Enabled", * name: "Enabled", * value: "true", * }, * { * description: "The feature is disabled", * identifier: "Disabled", * name: "Disabled", * value: "false", * }, * ], * }); * // Multivariate flag * const mymultivariateflag = new harness.platform.FeatureFlag("mymultivariateflag", { * defaultOffVariation: "trial20", * defaultOnVariation: "trial7", * identifier: "FREE_TRIAL_DURATION", * kind: "int", * orgId: "test", * permanent: false, * projectId: "testff", * variations: [ * { * description: "Free trial period 7 days", * identifier: "trial7", * name: "7 days trial", * value: "7", * }, * { * description: "Free trial period 14 days", * identifier: "trial14", * name: "14 days trial", * value: "14", * }, * { * description: "Free trial period 20 days", * identifier: "trial20", * name: "20 days trial", * value: "20", * }, * ], * }); * ``` */ class FeatureFlag extends pulumi.CustomResource { /** * Get an existing FeatureFlag 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 FeatureFlag(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of FeatureFlag. 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'] === FeatureFlag.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["archived"] = state ? state.archived : undefined; resourceInputs["defaultOffVariation"] = state ? state.defaultOffVariation : undefined; resourceInputs["defaultOnVariation"] = state ? state.defaultOnVariation : undefined; resourceInputs["gitDetails"] = state ? state.gitDetails : undefined; resourceInputs["identifier"] = state ? state.identifier : undefined; resourceInputs["kind"] = state ? state.kind : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["orgId"] = state ? state.orgId : undefined; resourceInputs["owner"] = state ? state.owner : undefined; resourceInputs["permanent"] = state ? state.permanent : undefined; resourceInputs["projectId"] = state ? state.projectId : undefined; resourceInputs["variations"] = state ? state.variations : undefined; } else { const args = argsOrState; if ((!args || args.defaultOffVariation === undefined) && !opts.urn) { throw new Error("Missing required property 'defaultOffVariation'"); } if ((!args || args.defaultOnVariation === undefined) && !opts.urn) { throw new Error("Missing required property 'defaultOnVariation'"); } if ((!args || args.identifier === undefined) && !opts.urn) { throw new Error("Missing required property 'identifier'"); } if ((!args || args.kind === undefined) && !opts.urn) { throw new Error("Missing required property 'kind'"); } if ((!args || args.orgId === undefined) && !opts.urn) { throw new Error("Missing required property 'orgId'"); } if ((!args || args.permanent === undefined) && !opts.urn) { throw new Error("Missing required property 'permanent'"); } if ((!args || args.projectId === undefined) && !opts.urn) { throw new Error("Missing required property 'projectId'"); } if ((!args || args.variations === undefined) && !opts.urn) { throw new Error("Missing required property 'variations'"); } resourceInputs["archived"] = args ? args.archived : undefined; resourceInputs["defaultOffVariation"] = args ? args.defaultOffVariation : undefined; resourceInputs["defaultOnVariation"] = args ? args.defaultOnVariation : undefined; resourceInputs["gitDetails"] = args ? args.gitDetails : undefined; resourceInputs["identifier"] = args ? args.identifier : undefined; resourceInputs["kind"] = args ? args.kind : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["orgId"] = args ? args.orgId : undefined; resourceInputs["owner"] = args ? args.owner : undefined; resourceInputs["permanent"] = args ? args.permanent : undefined; resourceInputs["projectId"] = args ? args.projectId : undefined; resourceInputs["variations"] = args ? args.variations : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(FeatureFlag.__pulumiType, name, resourceInputs, opts); } } exports.FeatureFlag = FeatureFlag; /** @internal */ FeatureFlag.__pulumiType = 'harness:platform/featureFlag:FeatureFlag'; //# sourceMappingURL=featureFlag.js.map