UNPKG

@pulumi/consul

Version:

A Pulumi package for creating and managing consul resources.

142 lines 5.1 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.ConfigEntryServiceSplitter = 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 web = new consul.ConfigEntry("web", { * name: "web", * kind: "service-defaults", * configJson: JSON.stringify({ * Protocol: "http", * Expose: {}, * MeshGateway: {}, * TransparentProxy: {}, * }), * }); * const serviceResolver = new consul.ConfigEntryServiceResolver("service_resolver", { * name: "service-resolver", * defaultSubset: "v1", * subsets: [ * { * name: "v1", * filter: "Service.Meta.version == v1", * }, * { * name: "v2", * filter: "Service.Meta.version == v2", * }, * ], * }); * const foo = new consul.ConfigEntryServiceSplitter("foo", { * name: serviceResolver.name, * meta: { * key: "value", * }, * splits: [ * { * weight: 80, * service: "web", * serviceSubset: "v1", * requestHeaders: { * set: { * "x-web-version": "from-v1", * }, * }, * responseHeaders: { * set: { * "x-web-version": "to-v1", * }, * }, * }, * { * weight: 10, * service: "web", * serviceSubset: "v2", * requestHeaders: { * set: { * "x-web-version": "from-v2", * }, * }, * responseHeaders: { * set: { * "x-web-version": "to-v2", * }, * }, * }, * { * weight: 10, * service: "web", * serviceSubset: "v2", * }, * ], * }); * ``` * * ## Import * * ```sh * $ pulumi import consul:index/configEntryServiceSplitter:ConfigEntryServiceSplitter foo web * ``` */ class ConfigEntryServiceSplitter extends pulumi.CustomResource { /** * Get an existing ConfigEntryServiceSplitter 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 ConfigEntryServiceSplitter(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ConfigEntryServiceSplitter. 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'] === ConfigEntryServiceSplitter.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["meta"] = state ? state.meta : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["namespace"] = state ? state.namespace : undefined; resourceInputs["partition"] = state ? state.partition : undefined; resourceInputs["splits"] = state ? state.splits : undefined; } else { const args = argsOrState; if ((!args || args.splits === undefined) && !opts.urn) { throw new Error("Missing required property 'splits'"); } resourceInputs["meta"] = args ? args.meta : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["namespace"] = args ? args.namespace : undefined; resourceInputs["partition"] = args ? args.partition : undefined; resourceInputs["splits"] = args ? args.splits : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ConfigEntryServiceSplitter.__pulumiType, name, resourceInputs, opts); } } exports.ConfigEntryServiceSplitter = ConfigEntryServiceSplitter; /** @internal */ ConfigEntryServiceSplitter.__pulumiType = 'consul:index/configEntryServiceSplitter:ConfigEntryServiceSplitter'; //# sourceMappingURL=configEntryServiceSplitter.js.map