UNPKG

@lbrlabs/pulumi-harness

Version:

A Pulumi package for creating and managing Harness resources.

137 lines 6.37 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.Token = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Resource for creating tokens. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as harness from "@lbrlabs/pulumi-harness"; * * // Create token for project level apikey * const test = new harness.platform.Token("test", { * accountId: "account_id", * apikeyId: "apikey_id", * apikeyType: "USER", * identifier: "test_token", * orgId: "org_id", * parentId: "apikey_parent_id", * projectId: "project_id", * }); * ``` * * ## Import * * Import account level token * * ```sh * $ pulumi import harness:platform/token:Token harness_platform_token <parent_id>/<apikey_id>/<apikey_type>/<token_id> * ``` * * Import org level token * * ```sh * $ pulumi import harness:platform/token:Token harness_platform_token <org_id>/<parent_id>/<apikey_id>/<apikey_type>/<token_id> * ``` * * Import project level token * * ```sh * $ pulumi import harness:platform/token:Token harness_platform_token <org_id>/<project_id>/<parent_id>/<apikey_id>/<apikey_type>/<token_id> * ``` */ class Token extends pulumi.CustomResource { /** * Get an existing Token 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 Token(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Token. 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'] === Token.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accountId"] = state ? state.accountId : undefined; resourceInputs["apikeyId"] = state ? state.apikeyId : undefined; resourceInputs["apikeyType"] = state ? state.apikeyType : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["email"] = state ? state.email : undefined; resourceInputs["encodedPassword"] = state ? state.encodedPassword : undefined; resourceInputs["identifier"] = state ? state.identifier : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["orgId"] = state ? state.orgId : undefined; resourceInputs["parentId"] = state ? state.parentId : undefined; resourceInputs["projectId"] = state ? state.projectId : undefined; resourceInputs["scheduledExpireTime"] = state ? state.scheduledExpireTime : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["username"] = state ? state.username : undefined; resourceInputs["valid"] = state ? state.valid : undefined; resourceInputs["validFrom"] = state ? state.validFrom : undefined; resourceInputs["validTo"] = state ? state.validTo : undefined; } else { const args = argsOrState; if ((!args || args.accountId === undefined) && !opts.urn) { throw new Error("Missing required property 'accountId'"); } if ((!args || args.apikeyId === undefined) && !opts.urn) { throw new Error("Missing required property 'apikeyId'"); } if ((!args || args.apikeyType === undefined) && !opts.urn) { throw new Error("Missing required property 'apikeyType'"); } if ((!args || args.identifier === undefined) && !opts.urn) { throw new Error("Missing required property 'identifier'"); } if ((!args || args.parentId === undefined) && !opts.urn) { throw new Error("Missing required property 'parentId'"); } resourceInputs["accountId"] = args ? args.accountId : undefined; resourceInputs["apikeyId"] = args ? args.apikeyId : undefined; resourceInputs["apikeyType"] = args ? args.apikeyType : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["email"] = args ? args.email : undefined; resourceInputs["encodedPassword"] = args ? args.encodedPassword : undefined; resourceInputs["identifier"] = args ? args.identifier : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["orgId"] = args ? args.orgId : undefined; resourceInputs["parentId"] = args ? args.parentId : undefined; resourceInputs["projectId"] = args ? args.projectId : undefined; resourceInputs["scheduledExpireTime"] = args ? args.scheduledExpireTime : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["username"] = args ? args.username : undefined; resourceInputs["valid"] = args ? args.valid : undefined; resourceInputs["validFrom"] = args ? args.validFrom : undefined; resourceInputs["validTo"] = args ? args.validTo : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Token.__pulumiType, name, resourceInputs, opts); } } exports.Token = Token; /** @internal */ Token.__pulumiType = 'harness:platform/token:Token'; //# sourceMappingURL=token.js.map