@volcengine/pulumi
Version:
A Pulumi package for creating and managing volcengine cloud resources.
157 lines • 6.05 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 clb rule
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as volcengine from "@pulumi/volcengine";
* import * as volcengine from "@volcengine/pulumi";
*
* const fooZones = volcengine.ecs.getZones({});
* const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
* vpcName: "acc-test-vpc",
* cidrBlock: "172.16.0.0/16",
* });
* const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
* subnetName: "acc-test-subnet",
* cidrBlock: "172.16.0.0/24",
* zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
* vpcId: fooVpc.id,
* });
* const fooClb = new volcengine.clb.Clb("fooClb", {
* type: "public",
* subnetId: fooSubnet.id,
* loadBalancerSpec: "small_1",
* description: "acc0Demo",
* loadBalancerName: "acc-test-create",
* eipBillingConfig: {
* isp: "BGP",
* eipBillingType: "PostPaidByBandwidth",
* bandwidth: 1,
* },
* });
* const fooServerGroup = new volcengine.clb.ServerGroup("fooServerGroup", {
* loadBalancerId: fooClb.id,
* serverGroupName: "acc-test-create",
* description: "hello demo11",
* });
* const fooListener = new volcengine.clb.Listener("fooListener", {
* loadBalancerId: fooClb.id,
* listenerName: "acc-test-listener",
* protocol: "HTTP",
* port: 90,
* serverGroupId: fooServerGroup.id,
* healthCheck: {
* enabled: "on",
* interval: 10,
* timeout: 3,
* healthyThreshold: 5,
* unHealthyThreshold: 2,
* domain: "volcengine.com",
* httpCode: "http_2xx",
* method: "GET",
* uri: "/",
* },
* enabled: "on",
* });
* const fooRule = new volcengine.clb.Rule("fooRule", {
* listenerId: fooListener.id,
* serverGroupId: fooServerGroup.id,
* domain: "test-volc123.com",
* url: "/tftest",
* tags: [{
* key: "k1",
* value: "v1",
* }],
* });
* const fooRedirect = new volcengine.clb.Rule("fooRedirect", {
* listenerId: fooListener.id,
* actionType: "Redirect",
* description: "Redirect rule",
* domain: "example1.com",
* redirectConfig: {
* protocol: "HTTP",
* host: "example3.com",
* path: "/test",
* port: "443",
* statusCode: "301",
* },
* });
* ```
*
* ## Import
*
* Rule can be imported using the id, e.g.
* Notice: resourceId is ruleId, due to the lack of describeRuleAttributes in openapi, for import resources, please use ruleId:listenerId to import.
* we will fix this problem later.
*
* ```sh
* $ pulumi import volcengine:clb/rule:Rule foo rule-273zb9hzi1gqo7fap8u1k3utb:lsn-273ywvnmiu70g7fap8u2xzg9d
* ```
*/
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["actionType"] = state ? state.actionType : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["domain"] = state ? state.domain : undefined;
resourceInputs["listenerId"] = state ? state.listenerId : undefined;
resourceInputs["redirectConfig"] = state ? state.redirectConfig : undefined;
resourceInputs["serverGroupId"] = state ? state.serverGroupId : undefined;
resourceInputs["tags"] = state ? state.tags : 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'");
}
resourceInputs["actionType"] = args ? args.actionType : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["domain"] = args ? args.domain : undefined;
resourceInputs["listenerId"] = args ? args.listenerId : undefined;
resourceInputs["redirectConfig"] = args ? args.redirectConfig : undefined;
resourceInputs["serverGroupId"] = args ? args.serverGroupId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["url"] = args ? args.url : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Rule.__pulumiType, name, resourceInputs, opts);
}
}
exports.Rule = Rule;
/** @internal */
Rule.__pulumiType = 'volcengine:clb/rule:Rule';
//# sourceMappingURL=rule.js.map