UNPKG

@pulumi/consul

Version:

A Pulumi package for creating and managing consul resources.

102 lines 4.35 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.KeyPrefix = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as consul from "@pulumi/consul"; * * const myappConfig = new consul.KeyPrefix("myapp_config", { * datacenter: "nyc1", * token: "abcd", * pathPrefix: "myapp/config/", * subkeys: { * elb_cname: appAwsElb.dnsName, * s3_bucket_name: appAwsS3Bucket.bucket, * "database/hostname": app.address, * "database/port": app.port, * "database/username": app.username, * "database/name": app.name, * }, * subkeyCollection: [{ * path: "database/password", * value: app.password, * flags: 2, * }], * }); * ``` * * ## Import * * `consul_key_prefix` can be imported. This is useful when the path already exists and * you know all keys in path should be managed by Terraform. * * ```sh * $ pulumi import consul:index/keyPrefix:KeyPrefix myapp_config myapp/config/ * ``` */ class KeyPrefix extends pulumi.CustomResource { /** * Get an existing KeyPrefix 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 KeyPrefix(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of KeyPrefix. 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'] === KeyPrefix.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["datacenter"] = state ? state.datacenter : undefined; resourceInputs["namespace"] = state ? state.namespace : undefined; resourceInputs["partition"] = state ? state.partition : undefined; resourceInputs["pathPrefix"] = state ? state.pathPrefix : undefined; resourceInputs["subkeyCollection"] = state ? state.subkeyCollection : undefined; resourceInputs["subkeys"] = state ? state.subkeys : undefined; resourceInputs["token"] = state ? state.token : undefined; } else { const args = argsOrState; if ((!args || args.pathPrefix === undefined) && !opts.urn) { throw new Error("Missing required property 'pathPrefix'"); } resourceInputs["datacenter"] = args ? args.datacenter : undefined; resourceInputs["namespace"] = args ? args.namespace : undefined; resourceInputs["partition"] = args ? args.partition : undefined; resourceInputs["pathPrefix"] = args ? args.pathPrefix : undefined; resourceInputs["subkeyCollection"] = args ? args.subkeyCollection : undefined; resourceInputs["subkeys"] = args ? args.subkeys : undefined; resourceInputs["token"] = (args === null || args === void 0 ? void 0 : args.token) ? pulumi.secret(args.token) : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["token"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(KeyPrefix.__pulumiType, name, resourceInputs, opts); } } exports.KeyPrefix = KeyPrefix; /** @internal */ KeyPrefix.__pulumiType = 'consul:index/keyPrefix:KeyPrefix'; //# sourceMappingURL=keyPrefix.js.map