1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. dcdn
  5. DomainConfig
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

alicloud.dcdn.DomainConfig

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

    Provides a DCDN Accelerated Domain resource.

    For information about domain config and how to use it, see Batch set config.

    NOTE: Available since v1.131.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const domainName = config.get("domainName") || "alibaba-example.com";
    const example = new alicloud.dcdn.Domain("example", {
        domainName: domainName,
        scope: "overseas",
        status: "online",
        sources: [{
            content: "1.1.1.1",
            type: "ipaddr",
            priority: "20",
            port: 80,
            weight: "10",
        }],
    });
    const ipAllowListSet = new alicloud.dcdn.DomainConfig("ipAllowListSet", {
        domainName: example.domainName,
        functionName: "ip_allow_list_set",
        functionArgs: [{
            argName: "ip_list",
            argValue: "192.168.0.1",
        }],
    });
    const refererWhiteListSet = new alicloud.dcdn.DomainConfig("refererWhiteListSet", {
        domainName: example.domainName,
        functionName: "referer_white_list_set",
        functionArgs: [{
            argName: "refer_domain_allow_list",
            argValue: "110.110.110.110",
        }],
    });
    const filetypeBasedTtlSet = new alicloud.dcdn.DomainConfig("filetypeBasedTtlSet", {
        domainName: example.domainName,
        functionName: "filetype_based_ttl_set",
        functionArgs: [
            {
                argName: "ttl",
                argValue: "300",
            },
            {
                argName: "file_type",
                argValue: "jpg",
            },
            {
                argName: "weight",
                argValue: "1",
            },
        ],
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    domain_name = config.get("domainName")
    if domain_name is None:
        domain_name = "alibaba-example.com"
    example = alicloud.dcdn.Domain("example",
        domain_name=domain_name,
        scope="overseas",
        status="online",
        sources=[alicloud.dcdn.DomainSourceArgs(
            content="1.1.1.1",
            type="ipaddr",
            priority="20",
            port=80,
            weight="10",
        )])
    ip_allow_list_set = alicloud.dcdn.DomainConfig("ipAllowListSet",
        domain_name=example.domain_name,
        function_name="ip_allow_list_set",
        function_args=[alicloud.dcdn.DomainConfigFunctionArgArgs(
            arg_name="ip_list",
            arg_value="192.168.0.1",
        )])
    referer_white_list_set = alicloud.dcdn.DomainConfig("refererWhiteListSet",
        domain_name=example.domain_name,
        function_name="referer_white_list_set",
        function_args=[alicloud.dcdn.DomainConfigFunctionArgArgs(
            arg_name="refer_domain_allow_list",
            arg_value="110.110.110.110",
        )])
    filetype_based_ttl_set = alicloud.dcdn.DomainConfig("filetypeBasedTtlSet",
        domain_name=example.domain_name,
        function_name="filetype_based_ttl_set",
        function_args=[
            alicloud.dcdn.DomainConfigFunctionArgArgs(
                arg_name="ttl",
                arg_value="300",
            ),
            alicloud.dcdn.DomainConfigFunctionArgArgs(
                arg_name="file_type",
                arg_value="jpg",
            ),
            alicloud.dcdn.DomainConfigFunctionArgArgs(
                arg_name="weight",
                arg_value="1",
            ),
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dcdn"
    	"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, "")
    		domainName := "alibaba-example.com"
    		if param := cfg.Get("domainName"); param != "" {
    			domainName = param
    		}
    		example, err := dcdn.NewDomain(ctx, "example", &dcdn.DomainArgs{
    			DomainName: pulumi.String(domainName),
    			Scope:      pulumi.String("overseas"),
    			Status:     pulumi.String("online"),
    			Sources: dcdn.DomainSourceArray{
    				&dcdn.DomainSourceArgs{
    					Content:  pulumi.String("1.1.1.1"),
    					Type:     pulumi.String("ipaddr"),
    					Priority: pulumi.String("20"),
    					Port:     pulumi.Int(80),
    					Weight:   pulumi.String("10"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dcdn.NewDomainConfig(ctx, "ipAllowListSet", &dcdn.DomainConfigArgs{
    			DomainName:   example.DomainName,
    			FunctionName: pulumi.String("ip_allow_list_set"),
    			FunctionArgs: dcdn.DomainConfigFunctionArgArray{
    				&dcdn.DomainConfigFunctionArgArgs{
    					ArgName:  pulumi.String("ip_list"),
    					ArgValue: pulumi.String("192.168.0.1"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dcdn.NewDomainConfig(ctx, "refererWhiteListSet", &dcdn.DomainConfigArgs{
    			DomainName:   example.DomainName,
    			FunctionName: pulumi.String("referer_white_list_set"),
    			FunctionArgs: dcdn.DomainConfigFunctionArgArray{
    				&dcdn.DomainConfigFunctionArgArgs{
    					ArgName:  pulumi.String("refer_domain_allow_list"),
    					ArgValue: pulumi.String("110.110.110.110"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dcdn.NewDomainConfig(ctx, "filetypeBasedTtlSet", &dcdn.DomainConfigArgs{
    			DomainName:   example.DomainName,
    			FunctionName: pulumi.String("filetype_based_ttl_set"),
    			FunctionArgs: dcdn.DomainConfigFunctionArgArray{
    				&dcdn.DomainConfigFunctionArgArgs{
    					ArgName:  pulumi.String("ttl"),
    					ArgValue: pulumi.String("300"),
    				},
    				&dcdn.DomainConfigFunctionArgArgs{
    					ArgName:  pulumi.String("file_type"),
    					ArgValue: pulumi.String("jpg"),
    				},
    				&dcdn.DomainConfigFunctionArgArgs{
    					ArgName:  pulumi.String("weight"),
    					ArgValue: pulumi.String("1"),
    				},
    			},
    		})
    		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 domainName = config.Get("domainName") ?? "alibaba-example.com";
        var example = new AliCloud.Dcdn.Domain("example", new()
        {
            DomainName = domainName,
            Scope = "overseas",
            Status = "online",
            Sources = new[]
            {
                new AliCloud.Dcdn.Inputs.DomainSourceArgs
                {
                    Content = "1.1.1.1",
                    Type = "ipaddr",
                    Priority = "20",
                    Port = 80,
                    Weight = "10",
                },
            },
        });
    
        var ipAllowListSet = new AliCloud.Dcdn.DomainConfig("ipAllowListSet", new()
        {
            DomainName = example.DomainName,
            FunctionName = "ip_allow_list_set",
            FunctionArgs = new[]
            {
                new AliCloud.Dcdn.Inputs.DomainConfigFunctionArgArgs
                {
                    ArgName = "ip_list",
                    ArgValue = "192.168.0.1",
                },
            },
        });
    
        var refererWhiteListSet = new AliCloud.Dcdn.DomainConfig("refererWhiteListSet", new()
        {
            DomainName = example.DomainName,
            FunctionName = "referer_white_list_set",
            FunctionArgs = new[]
            {
                new AliCloud.Dcdn.Inputs.DomainConfigFunctionArgArgs
                {
                    ArgName = "refer_domain_allow_list",
                    ArgValue = "110.110.110.110",
                },
            },
        });
    
        var filetypeBasedTtlSet = new AliCloud.Dcdn.DomainConfig("filetypeBasedTtlSet", new()
        {
            DomainName = example.DomainName,
            FunctionName = "filetype_based_ttl_set",
            FunctionArgs = new[]
            {
                new AliCloud.Dcdn.Inputs.DomainConfigFunctionArgArgs
                {
                    ArgName = "ttl",
                    ArgValue = "300",
                },
                new AliCloud.Dcdn.Inputs.DomainConfigFunctionArgArgs
                {
                    ArgName = "file_type",
                    ArgValue = "jpg",
                },
                new AliCloud.Dcdn.Inputs.DomainConfigFunctionArgArgs
                {
                    ArgName = "weight",
                    ArgValue = "1",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.dcdn.Domain;
    import com.pulumi.alicloud.dcdn.DomainArgs;
    import com.pulumi.alicloud.dcdn.inputs.DomainSourceArgs;
    import com.pulumi.alicloud.dcdn.DomainConfig;
    import com.pulumi.alicloud.dcdn.DomainConfigArgs;
    import com.pulumi.alicloud.dcdn.inputs.DomainConfigFunctionArgArgs;
    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 domainName = config.get("domainName").orElse("alibaba-example.com");
            var example = new Domain("example", DomainArgs.builder()        
                .domainName(domainName)
                .scope("overseas")
                .status("online")
                .sources(DomainSourceArgs.builder()
                    .content("1.1.1.1")
                    .type("ipaddr")
                    .priority(20)
                    .port(80)
                    .weight(10)
                    .build())
                .build());
    
            var ipAllowListSet = new DomainConfig("ipAllowListSet", DomainConfigArgs.builder()        
                .domainName(example.domainName())
                .functionName("ip_allow_list_set")
                .functionArgs(DomainConfigFunctionArgArgs.builder()
                    .argName("ip_list")
                    .argValue("192.168.0.1")
                    .build())
                .build());
    
            var refererWhiteListSet = new DomainConfig("refererWhiteListSet", DomainConfigArgs.builder()        
                .domainName(example.domainName())
                .functionName("referer_white_list_set")
                .functionArgs(DomainConfigFunctionArgArgs.builder()
                    .argName("refer_domain_allow_list")
                    .argValue("110.110.110.110")
                    .build())
                .build());
    
            var filetypeBasedTtlSet = new DomainConfig("filetypeBasedTtlSet", DomainConfigArgs.builder()        
                .domainName(example.domainName())
                .functionName("filetype_based_ttl_set")
                .functionArgs(            
                    DomainConfigFunctionArgArgs.builder()
                        .argName("ttl")
                        .argValue("300")
                        .build(),
                    DomainConfigFunctionArgArgs.builder()
                        .argName("file_type")
                        .argValue("jpg")
                        .build(),
                    DomainConfigFunctionArgArgs.builder()
                        .argName("weight")
                        .argValue("1")
                        .build())
                .build());
    
        }
    }
    
    configuration:
      domainName:
        type: string
        default: alibaba-example.com
    resources:
      example:
        type: alicloud:dcdn:Domain
        properties:
          domainName: ${domainName}
          scope: overseas
          status: online
          sources:
            - content: 1.1.1.1
              type: ipaddr
              priority: 20
              port: 80
              weight: 10
      ipAllowListSet:
        type: alicloud:dcdn:DomainConfig
        properties:
          domainName: ${example.domainName}
          functionName: ip_allow_list_set
          functionArgs:
            - argName: ip_list
              argValue: 192.168.0.1
      refererWhiteListSet:
        type: alicloud:dcdn:DomainConfig
        properties:
          domainName: ${example.domainName}
          functionName: referer_white_list_set
          functionArgs:
            - argName: refer_domain_allow_list
              argValue: 110.110.110.110
      filetypeBasedTtlSet:
        type: alicloud:dcdn:DomainConfig
        properties:
          domainName: ${example.domainName}
          functionName: filetype_based_ttl_set
          functionArgs:
            - argName: ttl
              argValue: '300'
            - argName: file_type
              argValue: jpg
            - argName: weight
              argValue: '1'
    

    Create DomainConfig Resource

    new DomainConfig(name: string, args: DomainConfigArgs, opts?: CustomResourceOptions);
    @overload
    def DomainConfig(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     domain_name: Optional[str] = None,
                     function_args: Optional[Sequence[DomainConfigFunctionArgArgs]] = None,
                     function_name: Optional[str] = None)
    @overload
    def DomainConfig(resource_name: str,
                     args: DomainConfigArgs,
                     opts: Optional[ResourceOptions] = None)
    func NewDomainConfig(ctx *Context, name string, args DomainConfigArgs, opts ...ResourceOption) (*DomainConfig, error)
    public DomainConfig(string name, DomainConfigArgs args, CustomResourceOptions? opts = null)
    public DomainConfig(String name, DomainConfigArgs args)
    public DomainConfig(String name, DomainConfigArgs args, CustomResourceOptions options)
    
    type: alicloud:dcdn:DomainConfig
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args DomainConfigArgs
    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 DomainConfigArgs
    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 DomainConfigArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DomainConfigArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DomainConfigArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    DomainName string
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    FunctionArgs List<Pulumi.AliCloud.Dcdn.Inputs.DomainConfigFunctionArg>
    The args of the domain config. See function_args below.
    FunctionName string
    The name of the domain config.
    DomainName string
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    FunctionArgs []DomainConfigFunctionArgArgs
    The args of the domain config. See function_args below.
    FunctionName string
    The name of the domain config.
    domainName String
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    functionArgs List<DomainConfigFunctionArg>
    The args of the domain config. See function_args below.
    functionName String
    The name of the domain config.
    domainName string
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    functionArgs DomainConfigFunctionArg[]
    The args of the domain config. See function_args below.
    functionName string
    The name of the domain config.
    domain_name str
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    function_args Sequence[DomainConfigFunctionArgArgs]
    The args of the domain config. See function_args below.
    function_name str
    The name of the domain config.
    domainName String
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    functionArgs List<Property Map>
    The args of the domain config. See function_args below.
    functionName String
    The name of the domain config.

    Outputs

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

    ConfigId string
    The ID of the configuration.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the Config.
    ConfigId string
    The ID of the configuration.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the Config.
    configId String
    The ID of the configuration.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the Config.
    configId string
    The ID of the configuration.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the Config.
    config_id str
    The ID of the configuration.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the Config.
    configId String
    The ID of the configuration.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the Config.

    Look up Existing DomainConfig Resource

    Get an existing DomainConfig 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?: DomainConfigState, opts?: CustomResourceOptions): DomainConfig
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            config_id: Optional[str] = None,
            domain_name: Optional[str] = None,
            function_args: Optional[Sequence[DomainConfigFunctionArgArgs]] = None,
            function_name: Optional[str] = None,
            status: Optional[str] = None) -> DomainConfig
    func GetDomainConfig(ctx *Context, name string, id IDInput, state *DomainConfigState, opts ...ResourceOption) (*DomainConfig, error)
    public static DomainConfig Get(string name, Input<string> id, DomainConfigState? state, CustomResourceOptions? opts = null)
    public static DomainConfig get(String name, Output<String> id, DomainConfigState 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:
    ConfigId string
    The ID of the configuration.
    DomainName string
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    FunctionArgs List<Pulumi.AliCloud.Dcdn.Inputs.DomainConfigFunctionArg>
    The args of the domain config. See function_args below.
    FunctionName string
    The name of the domain config.
    Status string
    The status of the Config.
    ConfigId string
    The ID of the configuration.
    DomainName string
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    FunctionArgs []DomainConfigFunctionArgArgs
    The args of the domain config. See function_args below.
    FunctionName string
    The name of the domain config.
    Status string
    The status of the Config.
    configId String
    The ID of the configuration.
    domainName String
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    functionArgs List<DomainConfigFunctionArg>
    The args of the domain config. See function_args below.
    functionName String
    The name of the domain config.
    status String
    The status of the Config.
    configId string
    The ID of the configuration.
    domainName string
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    functionArgs DomainConfigFunctionArg[]
    The args of the domain config. See function_args below.
    functionName string
    The name of the domain config.
    status string
    The status of the Config.
    config_id str
    The ID of the configuration.
    domain_name str
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    function_args Sequence[DomainConfigFunctionArgArgs]
    The args of the domain config. See function_args below.
    function_name str
    The name of the domain config.
    status str
    The status of the Config.
    configId String
    The ID of the configuration.
    domainName String
    Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.
    functionArgs List<Property Map>
    The args of the domain config. See function_args below.
    functionName String
    The name of the domain config.
    status String
    The status of the Config.

    Supporting Types

    DomainConfigFunctionArg, DomainConfigFunctionArgArgs

    ArgName string
    The name of arg.
    ArgValue string
    The value of arg.
    ArgName string
    The name of arg.
    ArgValue string
    The value of arg.
    argName String
    The name of arg.
    argValue String
    The value of arg.
    argName string
    The name of arg.
    argValue string
    The value of arg.
    arg_name str
    The name of arg.
    arg_value str
    The value of arg.
    argName String
    The name of arg.
    argValue String
    The value of arg.

    Import

    DCDN domain config can be imported using the id, e.g.

    $ pulumi import alicloud:dcdn/domainConfig:DomainConfig example <domain_name>:<function_name>:<config_id>
    

    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.51.0 published on Saturday, Mar 23, 2024 by Pulumi