@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
136 lines • 5.04 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoadbalancerFrontendRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource represents load balancer frontend rule.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as upcloud from "@upcloud/pulumi-upcloud";
*
* const config = new pulumi.Config();
* const lbZone = config.get("lbZone") || "fi-hel2";
* const lbNetwork = new upcloud.Network("lb_network", {
* name: "lb-test-net",
* zone: lbZone,
* ipNetwork: {
* address: "10.0.0.0/24",
* dhcp: true,
* family: "IPv4",
* },
* });
* const lbFe1R1 = new upcloud.LoadbalancerFrontendRule("lb_fe_1_r1", {
* frontend: upcloudLoadbalancerFrontend.lbFe1.id,
* name: "lb-fe-1-r1-test",
* priority: 10,
* matchers: {
* srcIps: [{
* value: "192.168.0.0/24",
* }],
* },
* actions: {
* httpRewritePaths: [{
* matchPattern: "^/old/(.*)$",
* rewriteTo: "/new/\\1",
* }],
* useBackends: [{
* backendName: upcloudLoadbalancerBackend.lbBe1.name,
* }],
* },
* });
* const lbFe1 = new upcloud.LoadbalancerFrontend("lb_fe_1", {
* loadbalancer: upcloudLoadbalancer.lb.id,
* name: "lb-fe-1-test",
* mode: "http",
* port: 8080,
* defaultBackendName: upcloudLoadbalancerBackend.lbBe1.name,
* });
* const lb = new upcloud.Loadbalancer("lb", {
* configuredStatus: "started",
* name: "lb-test",
* plan: "development",
* zone: lbZone,
* networks: [
* {
* type: "public",
* family: "IPv4",
* name: "public",
* },
* {
* type: "private",
* family: "IPv4",
* name: "private",
* network: upcloudNetwork.lbNetwork.id,
* },
* ],
* });
* const lbBe1 = new upcloud.LoadbalancerBackend("lb_be_1", {
* loadbalancer: upcloudLoadbalancer.lb.id,
* name: "lb-be-1-test",
* });
* ```
*/
class LoadbalancerFrontendRule extends pulumi.CustomResource {
/**
* Get an existing LoadbalancerFrontendRule 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 LoadbalancerFrontendRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of LoadbalancerFrontendRule. 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'] === LoadbalancerFrontendRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["actions"] = state?.actions;
resourceInputs["frontend"] = state?.frontend;
resourceInputs["matchers"] = state?.matchers;
resourceInputs["matchingCondition"] = state?.matchingCondition;
resourceInputs["name"] = state?.name;
resourceInputs["priority"] = state?.priority;
}
else {
const args = argsOrState;
if (args?.frontend === undefined && !opts.urn) {
throw new Error("Missing required property 'frontend'");
}
if (args?.priority === undefined && !opts.urn) {
throw new Error("Missing required property 'priority'");
}
resourceInputs["actions"] = args?.actions;
resourceInputs["frontend"] = args?.frontend;
resourceInputs["matchers"] = args?.matchers;
resourceInputs["matchingCondition"] = args?.matchingCondition;
resourceInputs["name"] = args?.name;
resourceInputs["priority"] = args?.priority;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(LoadbalancerFrontendRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.LoadbalancerFrontendRule = LoadbalancerFrontendRule;
/** @internal */
LoadbalancerFrontendRule.__pulumiType = 'upcloud:index/loadbalancerFrontendRule:LoadbalancerFrontendRule';
//# sourceMappingURL=loadbalancerFrontendRule.js.map