@volcengine/pulumi
Version:
A Pulumi package for creating and managing volcengine cloud resources.
162 lines • 7.19 kB
JavaScript
;
// *** 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.Rule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource to manage alb rule
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as volcengine from "@volcengine/pulumi";
*
* // Basic edition
* const foo = new volcengine.alb.Rule("foo", {
* description: "test",
* domain: "www.test.com",
* listenerId: "lsn-1iidd19u4oni874adhezjkyj3",
* redirectConfig: {
* redirectDomain: "www.testtest.com",
* redirectHttpCode: "302",
* redirectPort: "555",
* redirectUri: "/testtest",
* },
* rewriteConfig: {
* rewritePath: "/test",
* },
* rewriteEnabled: "off",
* ruleAction: "Redirect",
* serverGroupId: "rsp-1g72w74y4umf42zbhq4k4hnln",
* trafficLimitEnabled: "off",
* trafficLimitQps: 100,
* url: "/test",
* });
* // Standard edition
* const example = new volcengine.alb.Rule("example", {
* description: "standard edition alb rule",
* listenerId: "lsn-bddjp5fcof0g8dv40naga1yd",
* priority: 1,
* ruleAction: "",
* ruleActions: [{
* forwardGroupConfig: {
* serverGroupStickySession: {
* enabled: "off",
* },
* serverGroupTuples: [{
* serverGroupId: "rsp-bdd1lpcbvv288dv40ov1sye0",
* weight: 50,
* }],
* },
* type: "ForwardGroup",
* }],
* ruleConditions: [
* {
* hostConfig: {
* values: ["www.example.com"],
* },
* type: "Host",
* },
* {
* pathConfig: {
* values: ["/app/*"],
* },
* type: "Path",
* },
* ],
* url: "",
* });
* ```
*
* ## Import
*
* AlbRule can be imported using the listener id and rule id, e.g.
*
* ```sh
* $ pulumi import volcengine:alb/rule:Rule default lsn-273yv0mhs5xj47fap8sehiiso:rule-****
* ```
*/
class Rule extends pulumi.CustomResource {
/**
* Get an existing Rule 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 Rule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Rule. 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'] === Rule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["domain"] = state ? state.domain : undefined;
resourceInputs["listenerId"] = state ? state.listenerId : undefined;
resourceInputs["priority"] = state ? state.priority : undefined;
resourceInputs["redirectConfig"] = state ? state.redirectConfig : undefined;
resourceInputs["rewriteConfig"] = state ? state.rewriteConfig : undefined;
resourceInputs["rewriteEnabled"] = state ? state.rewriteEnabled : undefined;
resourceInputs["ruleAction"] = state ? state.ruleAction : undefined;
resourceInputs["ruleActions"] = state ? state.ruleActions : undefined;
resourceInputs["ruleConditions"] = state ? state.ruleConditions : undefined;
resourceInputs["ruleId"] = state ? state.ruleId : undefined;
resourceInputs["serverGroupId"] = state ? state.serverGroupId : undefined;
resourceInputs["serverGroupTuples"] = state ? state.serverGroupTuples : undefined;
resourceInputs["stickySessionEnabled"] = state ? state.stickySessionEnabled : undefined;
resourceInputs["stickySessionTimeout"] = state ? state.stickySessionTimeout : undefined;
resourceInputs["trafficLimitEnabled"] = state ? state.trafficLimitEnabled : undefined;
resourceInputs["trafficLimitQps"] = state ? state.trafficLimitQps : undefined;
resourceInputs["url"] = state ? state.url : undefined;
}
else {
const args = argsOrState;
if ((!args || args.listenerId === undefined) && !opts.urn) {
throw new Error("Missing required property 'listenerId'");
}
if ((!args || args.ruleAction === undefined) && !opts.urn) {
throw new Error("Missing required property 'ruleAction'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["domain"] = args ? args.domain : undefined;
resourceInputs["listenerId"] = args ? args.listenerId : undefined;
resourceInputs["priority"] = args ? args.priority : undefined;
resourceInputs["redirectConfig"] = args ? args.redirectConfig : undefined;
resourceInputs["rewriteConfig"] = args ? args.rewriteConfig : undefined;
resourceInputs["rewriteEnabled"] = args ? args.rewriteEnabled : undefined;
resourceInputs["ruleAction"] = args ? args.ruleAction : undefined;
resourceInputs["ruleActions"] = args ? args.ruleActions : undefined;
resourceInputs["ruleConditions"] = args ? args.ruleConditions : undefined;
resourceInputs["serverGroupId"] = args ? args.serverGroupId : undefined;
resourceInputs["serverGroupTuples"] = args ? args.serverGroupTuples : undefined;
resourceInputs["stickySessionEnabled"] = args ? args.stickySessionEnabled : undefined;
resourceInputs["stickySessionTimeout"] = args ? args.stickySessionTimeout : undefined;
resourceInputs["trafficLimitEnabled"] = args ? args.trafficLimitEnabled : undefined;
resourceInputs["trafficLimitQps"] = args ? args.trafficLimitQps : undefined;
resourceInputs["url"] = args ? args.url : undefined;
resourceInputs["ruleId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Rule.__pulumiType, name, resourceInputs, opts);
}
}
exports.Rule = Rule;
/** @internal */
Rule.__pulumiType = 'volcengine:alb/rule:Rule';
//# sourceMappingURL=rule.js.map