1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. ddos
  5. Port
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.ddos.Port

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    Provides a Anti-DDoS Pro Port resource.

    For information about Anti-DDoS Pro Port and how to use it, see What is Port.

    NOTE: Available since v1.123.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const defaultDdosCooInstance = new alicloud.ddos.DdosCooInstance("defaultDdosCooInstance", {
        bandwidth: "30",
        baseBandwidth: "30",
        serviceBandwidth: "100",
        portCount: "50",
        domainCount: "50",
        period: 1,
        productType: "ddoscoo",
    });
    const defaultPort = new alicloud.ddos.Port("defaultPort", {
        instanceId: defaultDdosCooInstance.id,
        frontendPort: "7001",
        backendPort: "7002",
        frontendProtocol: "tcp",
        realServers: [
            "1.1.1.1",
            "2.2.2.2",
        ],
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default_ddos_coo_instance = alicloud.ddos.DdosCooInstance("defaultDdosCooInstance",
        bandwidth="30",
        base_bandwidth="30",
        service_bandwidth="100",
        port_count="50",
        domain_count="50",
        period=1,
        product_type="ddoscoo")
    default_port = alicloud.ddos.Port("defaultPort",
        instance_id=default_ddos_coo_instance.id,
        frontend_port="7001",
        backend_port="7002",
        frontend_protocol="tcp",
        real_servers=[
            "1.1.1.1",
            "2.2.2.2",
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ddos"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		defaultDdosCooInstance, err := ddos.NewDdosCooInstance(ctx, "defaultDdosCooInstance", &ddos.DdosCooInstanceArgs{
    			Bandwidth:        pulumi.String("30"),
    			BaseBandwidth:    pulumi.String("30"),
    			ServiceBandwidth: pulumi.String("100"),
    			PortCount:        pulumi.String("50"),
    			DomainCount:      pulumi.String("50"),
    			Period:           pulumi.Int(1),
    			ProductType:      pulumi.String("ddoscoo"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ddos.NewPort(ctx, "defaultPort", &ddos.PortArgs{
    			InstanceId:       defaultDdosCooInstance.ID(),
    			FrontendPort:     pulumi.String("7001"),
    			BackendPort:      pulumi.String("7002"),
    			FrontendProtocol: pulumi.String("tcp"),
    			RealServers: pulumi.StringArray{
    				pulumi.String("1.1.1.1"),
    				pulumi.String("2.2.2.2"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var defaultDdosCooInstance = new AliCloud.Ddos.DdosCooInstance("defaultDdosCooInstance", new()
        {
            Bandwidth = "30",
            BaseBandwidth = "30",
            ServiceBandwidth = "100",
            PortCount = "50",
            DomainCount = "50",
            Period = 1,
            ProductType = "ddoscoo",
        });
    
        var defaultPort = new AliCloud.Ddos.Port("defaultPort", new()
        {
            InstanceId = defaultDdosCooInstance.Id,
            FrontendPort = "7001",
            BackendPort = "7002",
            FrontendProtocol = "tcp",
            RealServers = new[]
            {
                "1.1.1.1",
                "2.2.2.2",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ddos.DdosCooInstance;
    import com.pulumi.alicloud.ddos.DdosCooInstanceArgs;
    import com.pulumi.alicloud.ddos.Port;
    import com.pulumi.alicloud.ddos.PortArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("tf-example");
            var defaultDdosCooInstance = new DdosCooInstance("defaultDdosCooInstance", DdosCooInstanceArgs.builder()        
                .bandwidth("30")
                .baseBandwidth("30")
                .serviceBandwidth("100")
                .portCount("50")
                .domainCount("50")
                .period("1")
                .productType("ddoscoo")
                .build());
    
            var defaultPort = new Port("defaultPort", PortArgs.builder()        
                .instanceId(defaultDdosCooInstance.id())
                .frontendPort("7001")
                .backendPort("7002")
                .frontendProtocol("tcp")
                .realServers(            
                    "1.1.1.1",
                    "2.2.2.2")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      defaultDdosCooInstance:
        type: alicloud:ddos:DdosCooInstance
        properties:
          bandwidth: '30'
          baseBandwidth: '30'
          serviceBandwidth: '100'
          portCount: '50'
          domainCount: '50'
          period: '1'
          productType: ddoscoo
      defaultPort:
        type: alicloud:ddos:Port
        properties:
          instanceId: ${defaultDdosCooInstance.id}
          frontendPort: '7001'
          backendPort: '7002'
          frontendProtocol: tcp
          realServers:
            - 1.1.1.1
            - 2.2.2.2
    

    Create Port Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Port(name: string, args: PortArgs, opts?: CustomResourceOptions);
    @overload
    def Port(resource_name: str,
             args: PortArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Port(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             frontend_port: Optional[str] = None,
             frontend_protocol: Optional[str] = None,
             instance_id: Optional[str] = None,
             real_servers: Optional[Sequence[str]] = None,
             backend_port: Optional[str] = None)
    func NewPort(ctx *Context, name string, args PortArgs, opts ...ResourceOption) (*Port, error)
    public Port(string name, PortArgs args, CustomResourceOptions? opts = null)
    public Port(String name, PortArgs args)
    public Port(String name, PortArgs args, CustomResourceOptions options)
    
    type: alicloud:ddos:Port
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args PortArgs
    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 PortArgs
    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 PortArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PortArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PortArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var portResource = new AliCloud.Ddos.Port("portResource", new()
    {
        FrontendPort = "string",
        FrontendProtocol = "string",
        InstanceId = "string",
        RealServers = new[]
        {
            "string",
        },
        BackendPort = "string",
    });
    
    example, err := ddos.NewPort(ctx, "portResource", &ddos.PortArgs{
    	FrontendPort:     pulumi.String("string"),
    	FrontendProtocol: pulumi.String("string"),
    	InstanceId:       pulumi.String("string"),
    	RealServers: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	BackendPort: pulumi.String("string"),
    })
    
    var portResource = new Port("portResource", PortArgs.builder()        
        .frontendPort("string")
        .frontendProtocol("string")
        .instanceId("string")
        .realServers("string")
        .backendPort("string")
        .build());
    
    port_resource = alicloud.ddos.Port("portResource",
        frontend_port="string",
        frontend_protocol="string",
        instance_id="string",
        real_servers=["string"],
        backend_port="string")
    
    const portResource = new alicloud.ddos.Port("portResource", {
        frontendPort: "string",
        frontendProtocol: "string",
        instanceId: "string",
        realServers: ["string"],
        backendPort: "string",
    });
    
    type: alicloud:ddos:Port
    properties:
        backendPort: string
        frontendPort: string
        frontendProtocol: string
        instanceId: string
        realServers:
            - string
    

    Port 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 Port resource accepts the following input properties:

    FrontendPort string
    The forwarding port. Valid values: [1~65535].
    FrontendProtocol string
    The forwarding protocol. Valid values tcp and udp.
    InstanceId string
    The ID of Ddoscoo instance.
    RealServers List<string>
    List of source IP addresses.
    BackendPort string
    The port of the origin server. Valid values: [1~65535].
    FrontendPort string
    The forwarding port. Valid values: [1~65535].
    FrontendProtocol string
    The forwarding protocol. Valid values tcp and udp.
    InstanceId string
    The ID of Ddoscoo instance.
    RealServers []string
    List of source IP addresses.
    BackendPort string
    The port of the origin server. Valid values: [1~65535].
    frontendPort String
    The forwarding port. Valid values: [1~65535].
    frontendProtocol String
    The forwarding protocol. Valid values tcp and udp.
    instanceId String
    The ID of Ddoscoo instance.
    realServers List<String>
    List of source IP addresses.
    backendPort String
    The port of the origin server. Valid values: [1~65535].
    frontendPort string
    The forwarding port. Valid values: [1~65535].
    frontendProtocol string
    The forwarding protocol. Valid values tcp and udp.
    instanceId string
    The ID of Ddoscoo instance.
    realServers string[]
    List of source IP addresses.
    backendPort string
    The port of the origin server. Valid values: [1~65535].
    frontend_port str
    The forwarding port. Valid values: [1~65535].
    frontend_protocol str
    The forwarding protocol. Valid values tcp and udp.
    instance_id str
    The ID of Ddoscoo instance.
    real_servers Sequence[str]
    List of source IP addresses.
    backend_port str
    The port of the origin server. Valid values: [1~65535].
    frontendPort String
    The forwarding port. Valid values: [1~65535].
    frontendProtocol String
    The forwarding protocol. Valid values tcp and udp.
    instanceId String
    The ID of Ddoscoo instance.
    realServers List<String>
    List of source IP addresses.
    backendPort String
    The port of the origin server. Valid values: [1~65535].

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Port Resource

    Get an existing Port 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?: PortState, opts?: CustomResourceOptions): Port
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            backend_port: Optional[str] = None,
            frontend_port: Optional[str] = None,
            frontend_protocol: Optional[str] = None,
            instance_id: Optional[str] = None,
            real_servers: Optional[Sequence[str]] = None) -> Port
    func GetPort(ctx *Context, name string, id IDInput, state *PortState, opts ...ResourceOption) (*Port, error)
    public static Port Get(string name, Input<string> id, PortState? state, CustomResourceOptions? opts = null)
    public static Port get(String name, Output<String> id, PortState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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:
    BackendPort string
    The port of the origin server. Valid values: [1~65535].
    FrontendPort string
    The forwarding port. Valid values: [1~65535].
    FrontendProtocol string
    The forwarding protocol. Valid values tcp and udp.
    InstanceId string
    The ID of Ddoscoo instance.
    RealServers List<string>
    List of source IP addresses.
    BackendPort string
    The port of the origin server. Valid values: [1~65535].
    FrontendPort string
    The forwarding port. Valid values: [1~65535].
    FrontendProtocol string
    The forwarding protocol. Valid values tcp and udp.
    InstanceId string
    The ID of Ddoscoo instance.
    RealServers []string
    List of source IP addresses.
    backendPort String
    The port of the origin server. Valid values: [1~65535].
    frontendPort String
    The forwarding port. Valid values: [1~65535].
    frontendProtocol String
    The forwarding protocol. Valid values tcp and udp.
    instanceId String
    The ID of Ddoscoo instance.
    realServers List<String>
    List of source IP addresses.
    backendPort string
    The port of the origin server. Valid values: [1~65535].
    frontendPort string
    The forwarding port. Valid values: [1~65535].
    frontendProtocol string
    The forwarding protocol. Valid values tcp and udp.
    instanceId string
    The ID of Ddoscoo instance.
    realServers string[]
    List of source IP addresses.
    backend_port str
    The port of the origin server. Valid values: [1~65535].
    frontend_port str
    The forwarding port. Valid values: [1~65535].
    frontend_protocol str
    The forwarding protocol. Valid values tcp and udp.
    instance_id str
    The ID of Ddoscoo instance.
    real_servers Sequence[str]
    List of source IP addresses.
    backendPort String
    The port of the origin server. Valid values: [1~65535].
    frontendPort String
    The forwarding port. Valid values: [1~65535].
    frontendProtocol String
    The forwarding protocol. Valid values tcp and udp.
    instanceId String
    The ID of Ddoscoo instance.
    realServers List<String>
    List of source IP addresses.

    Import

    Anti-DDoS Pro Port can be imported using the id, e.g.

    $ pulumi import alicloud:ddos/port:Port example <instance_id>:<frontend_port>:<frontend_protocol>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi