Alibaba Cloud

v3.10.0 published on Wednesday, Nov 24, 2021 by Pulumi

Listener

Provides a Global Accelerator (GA) Listener resource.

For information about Global Accelerator (GA) Listener and how to use it, see What is Listener.

NOTE: Available in v1.111.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleAccelerator = new AliCloud.Ga.Accelerator("exampleAccelerator", new AliCloud.Ga.AcceleratorArgs
        {
            Duration = 1,
            AutoUseCoupon = true,
            Spec = "1",
        });
        var deBandwidthPackage = new AliCloud.Ga.BandwidthPackage("deBandwidthPackage", new AliCloud.Ga.BandwidthPackageArgs
        {
            Bandwidth = 100,
            Type = "Basic",
            BandwidthType = "Basic",
            PaymentType = "PayAsYouGo",
            BillingType = "PayBy95",
            Ratio = 30,
        });
        var deBandwidthPackageAttachment = new AliCloud.Ga.BandwidthPackageAttachment("deBandwidthPackageAttachment", new AliCloud.Ga.BandwidthPackageAttachmentArgs
        {
            AcceleratorId = exampleAccelerator.Id,
            BandwidthPackageId = deBandwidthPackage.Id,
        });
        var exampleListener = new AliCloud.Ga.Listener("exampleListener", new AliCloud.Ga.ListenerArgs
        {
            AcceleratorId = exampleAccelerator.Id,
            PortRanges = 
            {
                new AliCloud.Ga.Inputs.ListenerPortRangeArgs
                {
                    FromPort = 60,
                    ToPort = 70,
                },
            },
        }, new CustomResourceOptions
        {
            DependsOn = 
            {
                deBandwidthPackageAttachment,
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ga"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleAccelerator, err := ga.NewAccelerator(ctx, "exampleAccelerator", &ga.AcceleratorArgs{
			Duration:      pulumi.Int(1),
			AutoUseCoupon: pulumi.Bool(true),
			Spec:          pulumi.String("1"),
		})
		if err != nil {
			return err
		}
		deBandwidthPackage, err := ga.NewBandwidthPackage(ctx, "deBandwidthPackage", &ga.BandwidthPackageArgs{
			Bandwidth:     pulumi.Int(100),
			Type:          pulumi.String("Basic"),
			BandwidthType: pulumi.String("Basic"),
			PaymentType:   pulumi.String("PayAsYouGo"),
			BillingType:   pulumi.String("PayBy95"),
			Ratio:         pulumi.Int(30),
		})
		if err != nil {
			return err
		}
		deBandwidthPackageAttachment, err := ga.NewBandwidthPackageAttachment(ctx, "deBandwidthPackageAttachment", &ga.BandwidthPackageAttachmentArgs{
			AcceleratorId:      exampleAccelerator.ID(),
			BandwidthPackageId: deBandwidthPackage.ID(),
		})
		if err != nil {
			return err
		}
		_, err = ga.NewListener(ctx, "exampleListener", &ga.ListenerArgs{
			AcceleratorId: exampleAccelerator.ID(),
			PortRanges: ga.ListenerPortRangeArray{
				&ga.ListenerPortRangeArgs{
					FromPort: pulumi.Int(60),
					ToPort:   pulumi.Int(70),
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			deBandwidthPackageAttachment,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_alicloud as alicloud

example_accelerator = alicloud.ga.Accelerator("exampleAccelerator",
    duration=1,
    auto_use_coupon=True,
    spec="1")
de_bandwidth_package = alicloud.ga.BandwidthPackage("deBandwidthPackage",
    bandwidth=100,
    type="Basic",
    bandwidth_type="Basic",
    payment_type="PayAsYouGo",
    billing_type="PayBy95",
    ratio=30)
de_bandwidth_package_attachment = alicloud.ga.BandwidthPackageAttachment("deBandwidthPackageAttachment",
    accelerator_id=example_accelerator.id,
    bandwidth_package_id=de_bandwidth_package.id)
example_listener = alicloud.ga.Listener("exampleListener",
    accelerator_id=example_accelerator.id,
    port_ranges=[alicloud.ga.ListenerPortRangeArgs(
        from_port=60,
        to_port=70,
    )],
    opts=pulumi.ResourceOptions(depends_on=[de_bandwidth_package_attachment]))
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const exampleAccelerator = new alicloud.ga.Accelerator("exampleAccelerator", {
    duration: 1,
    autoUseCoupon: true,
    spec: "1",
});
const deBandwidthPackage = new alicloud.ga.BandwidthPackage("deBandwidthPackage", {
    bandwidth: "100",
    type: "Basic",
    bandwidthType: "Basic",
    paymentType: "PayAsYouGo",
    billingType: "PayBy95",
    ratio: 30,
});
const deBandwidthPackageAttachment = new alicloud.ga.BandwidthPackageAttachment("deBandwidthPackageAttachment", {
    acceleratorId: exampleAccelerator.id,
    bandwidthPackageId: deBandwidthPackage.id,
});
const exampleListener = new alicloud.ga.Listener("exampleListener", {
    acceleratorId: exampleAccelerator.id,
    portRanges: [{
        fromPort: 60,
        toPort: 70,
    }],
}, {
    dependsOn: [deBandwidthPackageAttachment],
});

Create a Listener Resource

new Listener(name: string, args: ListenerArgs, opts?: CustomResourceOptions);
@overload
def Listener(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             accelerator_id: Optional[str] = None,
             certificates: Optional[Sequence[ListenerCertificateArgs]] = None,
             client_affinity: Optional[str] = None,
             description: Optional[str] = None,
             name: Optional[str] = None,
             port_ranges: Optional[Sequence[ListenerPortRangeArgs]] = None,
             protocol: Optional[str] = None,
             proxy_protocol: Optional[bool] = None)
@overload
def Listener(resource_name: str,
             args: ListenerArgs,
             opts: Optional[ResourceOptions] = None)
func NewListener(ctx *Context, name string, args ListenerArgs, opts ...ResourceOption) (*Listener, error)
public Listener(string name, ListenerArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ListenerArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ListenerArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ListenerArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ListenerArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Listener Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Listener resource accepts the following input properties:

AcceleratorId string
The accelerator id.
PortRanges List<Pulumi.AliCloud.Ga.Inputs.ListenerPortRangeArgs>
The portRanges of the listener.
Certificates List<Pulumi.AliCloud.Ga.Inputs.ListenerCertificateArgs>
The certificates of the listener.
ClientAffinity string
The clientAffinity of the listener. Default value is NONE. Valid values: NONE: client affinity is not maintained, that is, connection requests from the same client cannot always be directed to the same terminal node. SOURCE_IP: maintain client affinity. When a client accesses a stateful application, all requests from the same client can be directed to the same terminal node, regardless of the source port and protocol.
Description string
The description of the listener.
Name string
The name of the listener. The length of the name is 2-128 characters. It starts with uppercase and lowercase letters or Chinese characters. It can contain numbers and underscores and dashes.
Protocol string
Type of network transport protocol monitored. Default value is TCP. Valid values: TCP, UDP, HTTP, HTTPS.
ProxyProtocol bool
The proxy protocol of the listener. Default value is false. Valid value: true: Turn on the keep client source IP function. After it is turned on, the back-end service is supported to view the original IP address of the client. false: keep client source IP function is not turned on.
AcceleratorId string
The accelerator id.
PortRanges []ListenerPortRangeArgs
The portRanges of the listener.
Certificates []ListenerCertificateArgs
The certificates of the listener.
ClientAffinity string
The clientAffinity of the listener. Default value is NONE. Valid values: NONE: client affinity is not maintained, that is, connection requests from the same client cannot always be directed to the same terminal node. SOURCE_IP: maintain client affinity. When a client accesses a stateful application, all requests from the same client can be directed to the same terminal node, regardless of the source port and protocol.
Description string
The description of the listener.
Name string
The name of the listener. The length of the name is 2-128 characters. It starts with uppercase and lowercase letters or Chinese characters. It can contain numbers and underscores and dashes.
Protocol string
Type of network transport protocol monitored. Default value is TCP. Valid values: TCP, UDP, HTTP, HTTPS.
ProxyProtocol bool
The proxy protocol of the listener. Default value is false. Valid value: true: Turn on the keep client source IP function. After it is turned on, the back-end service is supported to view the original IP address of the client. false: keep client source IP function is not turned on.
acceleratorId string
The accelerator id.
portRanges ListenerPortRangeArgs[]
The portRanges of the listener.
certificates ListenerCertificateArgs[]
The certificates of the listener.
clientAffinity string
The clientAffinity of the listener. Default value is NONE. Valid values: NONE: client affinity is not maintained, that is, connection requests from the same client cannot always be directed to the same terminal node. SOURCE_IP: maintain client affinity. When a client accesses a stateful application, all requests from the same client can be directed to the same terminal node, regardless of the source port and protocol.
description string
The description of the listener.
name string
The name of the listener. The length of the name is 2-128 characters. It starts with uppercase and lowercase letters or Chinese characters. It can contain numbers and underscores and dashes.
protocol string
Type of network transport protocol monitored. Default value is TCP. Valid values: TCP, UDP, HTTP, HTTPS.
proxyProtocol boolean
The proxy protocol of the listener. Default value is false. Valid value: true: Turn on the keep client source IP function. After it is turned on, the back-end service is supported to view the original IP address of the client. false: keep client source IP function is not turned on.
accelerator_id str
The accelerator id.
port_ranges Sequence[ListenerPortRangeArgs]
The portRanges of the listener.
certificates Sequence[ListenerCertificateArgs]
The certificates of the listener.
client_affinity str
The clientAffinity of the listener. Default value is NONE. Valid values: NONE: client affinity is not maintained, that is, connection requests from the same client cannot always be directed to the same terminal node. SOURCE_IP: maintain client affinity. When a client accesses a stateful application, all requests from the same client can be directed to the same terminal node, regardless of the source port and protocol.
description str
The description of the listener.
name str
The name of the listener. The length of the name is 2-128 characters. It starts with uppercase and lowercase letters or Chinese characters. It can contain numbers and underscores and dashes.
protocol str
Type of network transport protocol monitored. Default value is TCP. Valid values: TCP, UDP, HTTP, HTTPS.
proxy_protocol bool
The proxy protocol of the listener. Default value is false. Valid value: true: Turn on the keep client source IP function. After it is turned on, the back-end service is supported to view the original IP address of the client. false: keep client source IP function is not turned on.

Outputs

All input properties are implicitly available as output properties. Additionally, the Listener resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Status string
The status of the listener.
Id string
The provider-assigned unique ID for this managed resource.
Status string
The status of the listener.
id string
The provider-assigned unique ID for this managed resource.
status string
The status of the listener.
id str
The provider-assigned unique ID for this managed resource.
status str
The status of the listener.

Look up an Existing Listener Resource

Get an existing Listener resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ListenerState, opts?: CustomResourceOptions): Listener
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        accelerator_id: Optional[str] = None,
        certificates: Optional[Sequence[ListenerCertificateArgs]] = None,
        client_affinity: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        port_ranges: Optional[Sequence[ListenerPortRangeArgs]] = None,
        protocol: Optional[str] = None,
        proxy_protocol: Optional[bool] = None,
        status: Optional[str] = None) -> Listener
func GetListener(ctx *Context, name string, id IDInput, state *ListenerState, opts ...ResourceOption) (*Listener, error)
public static Listener Get(string name, Input<string> id, ListenerState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

AcceleratorId string
The accelerator id.
Certificates List<Pulumi.AliCloud.Ga.Inputs.ListenerCertificateArgs>
The certificates of the listener.
ClientAffinity string
The clientAffinity of the listener. Default value is NONE. Valid values: NONE: client affinity is not maintained, that is, connection requests from the same client cannot always be directed to the same terminal node. SOURCE_IP: maintain client affinity. When a client accesses a stateful application, all requests from the same client can be directed to the same terminal node, regardless of the source port and protocol.
Description string
The description of the listener.
Name string
The name of the listener. The length of the name is 2-128 characters. It starts with uppercase and lowercase letters or Chinese characters. It can contain numbers and underscores and dashes.
PortRanges List<Pulumi.AliCloud.Ga.Inputs.ListenerPortRangeArgs>
The portRanges of the listener.
Protocol string
Type of network transport protocol monitored. Default value is TCP. Valid values: TCP, UDP, HTTP, HTTPS.
ProxyProtocol bool
The proxy protocol of the listener. Default value is false. Valid value: true: Turn on the keep client source IP function. After it is turned on, the back-end service is supported to view the original IP address of the client. false: keep client source IP function is not turned on.
Status string
The status of the listener.
AcceleratorId string
The accelerator id.
Certificates []ListenerCertificateArgs
The certificates of the listener.
ClientAffinity string
The clientAffinity of the listener. Default value is NONE. Valid values: NONE: client affinity is not maintained, that is, connection requests from the same client cannot always be directed to the same terminal node. SOURCE_IP: maintain client affinity. When a client accesses a stateful application, all requests from the same client can be directed to the same terminal node, regardless of the source port and protocol.
Description string
The description of the listener.
Name string
The name of the listener. The length of the name is 2-128 characters. It starts with uppercase and lowercase letters or Chinese characters. It can contain numbers and underscores and dashes.
PortRanges []ListenerPortRangeArgs
The portRanges of the listener.
Protocol string
Type of network transport protocol monitored. Default value is TCP. Valid values: TCP, UDP, HTTP, HTTPS.
ProxyProtocol bool
The proxy protocol of the listener. Default value is false. Valid value: true: Turn on the keep client source IP function. After it is turned on, the back-end service is supported to view the original IP address of the client. false: keep client source IP function is not turned on.
Status string
The status of the listener.
acceleratorId string
The accelerator id.
certificates ListenerCertificateArgs[]
The certificates of the listener.
clientAffinity string
The clientAffinity of the listener. Default value is NONE. Valid values: NONE: client affinity is not maintained, that is, connection requests from the same client cannot always be directed to the same terminal node. SOURCE_IP: maintain client affinity. When a client accesses a stateful application, all requests from the same client can be directed to the same terminal node, regardless of the source port and protocol.
description string
The description of the listener.
name string
The name of the listener. The length of the name is 2-128 characters. It starts with uppercase and lowercase letters or Chinese characters. It can contain numbers and underscores and dashes.
portRanges ListenerPortRangeArgs[]
The portRanges of the listener.
protocol string
Type of network transport protocol monitored. Default value is TCP. Valid values: TCP, UDP, HTTP, HTTPS.
proxyProtocol boolean
The proxy protocol of the listener. Default value is false. Valid value: true: Turn on the keep client source IP function. After it is turned on, the back-end service is supported to view the original IP address of the client. false: keep client source IP function is not turned on.
status string
The status of the listener.
accelerator_id str
The accelerator id.
certificates Sequence[ListenerCertificateArgs]
The certificates of the listener.
client_affinity str
The clientAffinity of the listener. Default value is NONE. Valid values: NONE: client affinity is not maintained, that is, connection requests from the same client cannot always be directed to the same terminal node. SOURCE_IP: maintain client affinity. When a client accesses a stateful application, all requests from the same client can be directed to the same terminal node, regardless of the source port and protocol.
description str
The description of the listener.
name str
The name of the listener. The length of the name is 2-128 characters. It starts with uppercase and lowercase letters or Chinese characters. It can contain numbers and underscores and dashes.
port_ranges Sequence[ListenerPortRangeArgs]
The portRanges of the listener.
protocol str
Type of network transport protocol monitored. Default value is TCP. Valid values: TCP, UDP, HTTP, HTTPS.
proxy_protocol bool
The proxy protocol of the listener. Default value is false. Valid value: true: Turn on the keep client source IP function. After it is turned on, the back-end service is supported to view the original IP address of the client. false: keep client source IP function is not turned on.
status str
The status of the listener.

Supporting Types

ListenerCertificate

Id string
The id of the certificate.
Id string
The id of the certificate.
id string
The id of the certificate.
id str
The id of the certificate.

ListenerPortRange

FromPort int
The initial listening port used to receive requests and forward them to terminal nodes.
ToPort int
The end listening port used to receive requests and forward them to terminal nodes.
FromPort int
The initial listening port used to receive requests and forward them to terminal nodes.
ToPort int
The end listening port used to receive requests and forward them to terminal nodes.
fromPort number
The initial listening port used to receive requests and forward them to terminal nodes.
toPort number
The end listening port used to receive requests and forward them to terminal nodes.
from_port int
The initial listening port used to receive requests and forward them to terminal nodes.
to_port int
The end listening port used to receive requests and forward them to terminal nodes.

Import

Ga Listener can be imported using the id, e.g.

 $ pulumi import alicloud:ga/listener:Listener example <id>

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.