UNPKG

@volcengine/pulumi

Version:

A Pulumi package for creating and managing volcengine cloud resources.

183 lines 8.6 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.Listener = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage listener * ## 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 fooTcp = new volcengine.clb.Listener("fooTcp", { * loadBalancerId: fooClb.id, * listenerName: "acc-test-listener", * protocol: "TCP", * port: 90, * serverGroupId: fooServerGroup.id, * enabled: "on", * bandwidth: 2, * proxyProtocolType: "standard", * persistenceType: "source_ip", * persistenceTimeout: 100, * connectionDrainEnabled: "on", * connectionDrainTimeout: 100, * }); * ``` * * ## Import * * Listener can be imported using the id, e.g. * * ```sh * $ pulumi import volcengine:clb/listener:Listener default lsn-273yv0mhs5xj47fap8sehiiso * ``` */ class Listener extends pulumi.CustomResource { /** * Get an existing Listener 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 Listener(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Listener. 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'] === Listener.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["aclIds"] = state ? state.aclIds : undefined; resourceInputs["aclStatus"] = state ? state.aclStatus : undefined; resourceInputs["aclType"] = state ? state.aclType : undefined; resourceInputs["bandwidth"] = state ? state.bandwidth : undefined; resourceInputs["certificateId"] = state ? state.certificateId : undefined; resourceInputs["connectionDrainEnabled"] = state ? state.connectionDrainEnabled : undefined; resourceInputs["connectionDrainTimeout"] = state ? state.connectionDrainTimeout : undefined; resourceInputs["cookie"] = state ? state.cookie : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["enabled"] = state ? state.enabled : undefined; resourceInputs["establishedTimeout"] = state ? state.establishedTimeout : undefined; resourceInputs["healthCheck"] = state ? state.healthCheck : undefined; resourceInputs["listenerId"] = state ? state.listenerId : undefined; resourceInputs["listenerName"] = state ? state.listenerName : undefined; resourceInputs["loadBalancerId"] = state ? state.loadBalancerId : undefined; resourceInputs["persistenceTimeout"] = state ? state.persistenceTimeout : undefined; resourceInputs["persistenceType"] = state ? state.persistenceType : undefined; resourceInputs["port"] = state ? state.port : undefined; resourceInputs["protocol"] = state ? state.protocol : undefined; resourceInputs["proxyProtocolType"] = state ? state.proxyProtocolType : undefined; resourceInputs["scheduler"] = state ? state.scheduler : undefined; resourceInputs["serverGroupId"] = state ? state.serverGroupId : undefined; } else { const args = argsOrState; if ((!args || args.loadBalancerId === undefined) && !opts.urn) { throw new Error("Missing required property 'loadBalancerId'"); } if ((!args || args.port === undefined) && !opts.urn) { throw new Error("Missing required property 'port'"); } if ((!args || args.protocol === undefined) && !opts.urn) { throw new Error("Missing required property 'protocol'"); } if ((!args || args.serverGroupId === undefined) && !opts.urn) { throw new Error("Missing required property 'serverGroupId'"); } resourceInputs["aclIds"] = args ? args.aclIds : undefined; resourceInputs["aclStatus"] = args ? args.aclStatus : undefined; resourceInputs["aclType"] = args ? args.aclType : undefined; resourceInputs["bandwidth"] = args ? args.bandwidth : undefined; resourceInputs["certificateId"] = args ? args.certificateId : undefined; resourceInputs["connectionDrainEnabled"] = args ? args.connectionDrainEnabled : undefined; resourceInputs["connectionDrainTimeout"] = args ? args.connectionDrainTimeout : undefined; resourceInputs["cookie"] = args ? args.cookie : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["enabled"] = args ? args.enabled : undefined; resourceInputs["establishedTimeout"] = args ? args.establishedTimeout : undefined; resourceInputs["healthCheck"] = args ? args.healthCheck : undefined; resourceInputs["listenerName"] = args ? args.listenerName : undefined; resourceInputs["loadBalancerId"] = args ? args.loadBalancerId : undefined; resourceInputs["persistenceTimeout"] = args ? args.persistenceTimeout : undefined; resourceInputs["persistenceType"] = args ? args.persistenceType : undefined; resourceInputs["port"] = args ? args.port : undefined; resourceInputs["protocol"] = args ? args.protocol : undefined; resourceInputs["proxyProtocolType"] = args ? args.proxyProtocolType : undefined; resourceInputs["scheduler"] = args ? args.scheduler : undefined; resourceInputs["serverGroupId"] = args ? args.serverGroupId : undefined; resourceInputs["listenerId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Listener.__pulumiType, name, resourceInputs, opts); } } exports.Listener = Listener; /** @internal */ Listener.__pulumiType = 'volcengine:clb/listener:Listener'; //# sourceMappingURL=listener.js.map