1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. ScfFunctionAlias
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.ScfFunctionAlias

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides a resource to create a scf function_alias

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    // by route
    const functionAlias = new tencentcloud.ScfFunctionAlias("functionAlias", {
        description: "matchs for test 12312312",
        functionName: "keep-1676351130",
        functionVersion: "3",
        namespace: "default",
        routingConfig: {
            additionalVersionMatches: [{
                expression: "testuser",
                key: "invoke.headers.User",
                method: "exact",
                version: "2",
            }],
        },
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    # by route
    function_alias = tencentcloud.ScfFunctionAlias("functionAlias",
        description="matchs for test 12312312",
        function_name="keep-1676351130",
        function_version="3",
        namespace="default",
        routing_config={
            "additional_version_matches": [{
                "expression": "testuser",
                "key": "invoke.headers.User",
                "method": "exact",
                "version": "2",
            }],
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// by route
    		_, err := tencentcloud.NewScfFunctionAlias(ctx, "functionAlias", &tencentcloud.ScfFunctionAliasArgs{
    			Description:     pulumi.String("matchs for test 12312312"),
    			FunctionName:    pulumi.String("keep-1676351130"),
    			FunctionVersion: pulumi.String("3"),
    			Namespace:       pulumi.String("default"),
    			RoutingConfig: &tencentcloud.ScfFunctionAliasRoutingConfigArgs{
    				AdditionalVersionMatches: tencentcloud.ScfFunctionAliasRoutingConfigAdditionalVersionMatchArray{
    					&tencentcloud.ScfFunctionAliasRoutingConfigAdditionalVersionMatchArgs{
    						Expression: pulumi.String("testuser"),
    						Key:        pulumi.String("invoke.headers.User"),
    						Method:     pulumi.String("exact"),
    						Version:    pulumi.String("2"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        // by route
        var functionAlias = new Tencentcloud.ScfFunctionAlias("functionAlias", new()
        {
            Description = "matchs for test 12312312",
            FunctionName = "keep-1676351130",
            FunctionVersion = "3",
            Namespace = "default",
            RoutingConfig = new Tencentcloud.Inputs.ScfFunctionAliasRoutingConfigArgs
            {
                AdditionalVersionMatches = new[]
                {
                    new Tencentcloud.Inputs.ScfFunctionAliasRoutingConfigAdditionalVersionMatchArgs
                    {
                        Expression = "testuser",
                        Key = "invoke.headers.User",
                        Method = "exact",
                        Version = "2",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.ScfFunctionAlias;
    import com.pulumi.tencentcloud.ScfFunctionAliasArgs;
    import com.pulumi.tencentcloud.inputs.ScfFunctionAliasRoutingConfigArgs;
    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) {
            // by route
            var functionAlias = new ScfFunctionAlias("functionAlias", ScfFunctionAliasArgs.builder()
                .description("matchs for test 12312312")
                .functionName("keep-1676351130")
                .functionVersion("3")
                .namespace("default")
                .routingConfig(ScfFunctionAliasRoutingConfigArgs.builder()
                    .additionalVersionMatches(ScfFunctionAliasRoutingConfigAdditionalVersionMatchArgs.builder()
                        .expression("testuser")
                        .key("invoke.headers.User")
                        .method("exact")
                        .version("2")
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      # by route
      functionAlias:
        type: tencentcloud:ScfFunctionAlias
        properties:
          description: matchs for test 12312312
          functionName: keep-1676351130
          functionVersion: '3'
          namespace: default
          routingConfig:
            additionalVersionMatches:
              - expression: testuser
                key: invoke.headers.User
                method: exact
                version: '2'
    

    Create ScfFunctionAlias Resource

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

    Constructor syntax

    new ScfFunctionAlias(name: string, args: ScfFunctionAliasArgs, opts?: CustomResourceOptions);
    @overload
    def ScfFunctionAlias(resource_name: str,
                         args: ScfFunctionAliasArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def ScfFunctionAlias(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         function_name: Optional[str] = None,
                         function_version: Optional[str] = None,
                         description: Optional[str] = None,
                         name: Optional[str] = None,
                         namespace: Optional[str] = None,
                         routing_config: Optional[ScfFunctionAliasRoutingConfigArgs] = None,
                         scf_function_alias_id: Optional[str] = None)
    func NewScfFunctionAlias(ctx *Context, name string, args ScfFunctionAliasArgs, opts ...ResourceOption) (*ScfFunctionAlias, error)
    public ScfFunctionAlias(string name, ScfFunctionAliasArgs args, CustomResourceOptions? opts = null)
    public ScfFunctionAlias(String name, ScfFunctionAliasArgs args)
    public ScfFunctionAlias(String name, ScfFunctionAliasArgs args, CustomResourceOptions options)
    
    type: tencentcloud:ScfFunctionAlias
    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 ScfFunctionAliasArgs
    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 ScfFunctionAliasArgs
    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 ScfFunctionAliasArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ScfFunctionAliasArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ScfFunctionAliasArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    ScfFunctionAlias Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ScfFunctionAlias resource accepts the following input properties:

    FunctionName string
    Function name.
    FunctionVersion string
    Master version pointed to by the alias.
    Description string
    Alias description information.
    Name string
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    Namespace string
    Function namespace.
    RoutingConfig ScfFunctionAliasRoutingConfig
    Request routing configuration of alias.
    ScfFunctionAliasId string
    ID of the resource.
    FunctionName string
    Function name.
    FunctionVersion string
    Master version pointed to by the alias.
    Description string
    Alias description information.
    Name string
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    Namespace string
    Function namespace.
    RoutingConfig ScfFunctionAliasRoutingConfigArgs
    Request routing configuration of alias.
    ScfFunctionAliasId string
    ID of the resource.
    functionName String
    Function name.
    functionVersion String
    Master version pointed to by the alias.
    description String
    Alias description information.
    name String
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    namespace String
    Function namespace.
    routingConfig ScfFunctionAliasRoutingConfig
    Request routing configuration of alias.
    scfFunctionAliasId String
    ID of the resource.
    functionName string
    Function name.
    functionVersion string
    Master version pointed to by the alias.
    description string
    Alias description information.
    name string
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    namespace string
    Function namespace.
    routingConfig ScfFunctionAliasRoutingConfig
    Request routing configuration of alias.
    scfFunctionAliasId string
    ID of the resource.
    function_name str
    Function name.
    function_version str
    Master version pointed to by the alias.
    description str
    Alias description information.
    name str
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    namespace str
    Function namespace.
    routing_config ScfFunctionAliasRoutingConfigArgs
    Request routing configuration of alias.
    scf_function_alias_id str
    ID of the resource.
    functionName String
    Function name.
    functionVersion String
    Master version pointed to by the alias.
    description String
    Alias description information.
    name String
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    namespace String
    Function namespace.
    routingConfig Property Map
    Request routing configuration of alias.
    scfFunctionAliasId String
    ID of the resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ScfFunctionAlias 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 ScfFunctionAlias Resource

    Get an existing ScfFunctionAlias 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?: ScfFunctionAliasState, opts?: CustomResourceOptions): ScfFunctionAlias
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            function_name: Optional[str] = None,
            function_version: Optional[str] = None,
            name: Optional[str] = None,
            namespace: Optional[str] = None,
            routing_config: Optional[ScfFunctionAliasRoutingConfigArgs] = None,
            scf_function_alias_id: Optional[str] = None) -> ScfFunctionAlias
    func GetScfFunctionAlias(ctx *Context, name string, id IDInput, state *ScfFunctionAliasState, opts ...ResourceOption) (*ScfFunctionAlias, error)
    public static ScfFunctionAlias Get(string name, Input<string> id, ScfFunctionAliasState? state, CustomResourceOptions? opts = null)
    public static ScfFunctionAlias get(String name, Output<String> id, ScfFunctionAliasState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:ScfFunctionAlias    get:      id: ${id}
    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:
    Description string
    Alias description information.
    FunctionName string
    Function name.
    FunctionVersion string
    Master version pointed to by the alias.
    Name string
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    Namespace string
    Function namespace.
    RoutingConfig ScfFunctionAliasRoutingConfig
    Request routing configuration of alias.
    ScfFunctionAliasId string
    ID of the resource.
    Description string
    Alias description information.
    FunctionName string
    Function name.
    FunctionVersion string
    Master version pointed to by the alias.
    Name string
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    Namespace string
    Function namespace.
    RoutingConfig ScfFunctionAliasRoutingConfigArgs
    Request routing configuration of alias.
    ScfFunctionAliasId string
    ID of the resource.
    description String
    Alias description information.
    functionName String
    Function name.
    functionVersion String
    Master version pointed to by the alias.
    name String
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    namespace String
    Function namespace.
    routingConfig ScfFunctionAliasRoutingConfig
    Request routing configuration of alias.
    scfFunctionAliasId String
    ID of the resource.
    description string
    Alias description information.
    functionName string
    Function name.
    functionVersion string
    Master version pointed to by the alias.
    name string
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    namespace string
    Function namespace.
    routingConfig ScfFunctionAliasRoutingConfig
    Request routing configuration of alias.
    scfFunctionAliasId string
    ID of the resource.
    description str
    Alias description information.
    function_name str
    Function name.
    function_version str
    Master version pointed to by the alias.
    name str
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    namespace str
    Function namespace.
    routing_config ScfFunctionAliasRoutingConfigArgs
    Request routing configuration of alias.
    scf_function_alias_id str
    ID of the resource.
    description String
    Alias description information.
    functionName String
    Function name.
    functionVersion String
    Master version pointed to by the alias.
    name String
    Alias name, which must be unique in the function, can contain 1 to 64 letters, digits, _, and -, and must begin with a letter.
    namespace String
    Function namespace.
    routingConfig Property Map
    Request routing configuration of alias.
    scfFunctionAliasId String
    ID of the resource.

    Supporting Types

    ScfFunctionAliasRoutingConfig, ScfFunctionAliasRoutingConfigArgs

    additionalVersionMatches List<Property Map>
    Additional version with rule-based routing.
    additionalVersionWeights List<Property Map>
    Additional version with random weight-based routing.

    ScfFunctionAliasRoutingConfigAdditionalVersionMatch, ScfFunctionAliasRoutingConfigAdditionalVersionMatchArgs

    Expression string
    Rule requirements for range match:It should be described in an open or closed range, i.e., (a,b) or [a,b], where both a and b are integersRule requirements for exact match:Exact string match.
    Key string
    Matching rule key. When the API is called, pass in the key to route the request to the specified version based on the matching ruleHeader method:Enter invoke.headers.User for key and pass in RoutingKey:{User:value} when invoking a function through invoke for invocation based on rule matching.
    Method string
    Match method. Valid values:range: Range matchexact: exact string match.
    Version string
    Function version name.
    Expression string
    Rule requirements for range match:It should be described in an open or closed range, i.e., (a,b) or [a,b], where both a and b are integersRule requirements for exact match:Exact string match.
    Key string
    Matching rule key. When the API is called, pass in the key to route the request to the specified version based on the matching ruleHeader method:Enter invoke.headers.User for key and pass in RoutingKey:{User:value} when invoking a function through invoke for invocation based on rule matching.
    Method string
    Match method. Valid values:range: Range matchexact: exact string match.
    Version string
    Function version name.
    expression String
    Rule requirements for range match:It should be described in an open or closed range, i.e., (a,b) or [a,b], where both a and b are integersRule requirements for exact match:Exact string match.
    key String
    Matching rule key. When the API is called, pass in the key to route the request to the specified version based on the matching ruleHeader method:Enter invoke.headers.User for key and pass in RoutingKey:{User:value} when invoking a function through invoke for invocation based on rule matching.
    method String
    Match method. Valid values:range: Range matchexact: exact string match.
    version String
    Function version name.
    expression string
    Rule requirements for range match:It should be described in an open or closed range, i.e., (a,b) or [a,b], where both a and b are integersRule requirements for exact match:Exact string match.
    key string
    Matching rule key. When the API is called, pass in the key to route the request to the specified version based on the matching ruleHeader method:Enter invoke.headers.User for key and pass in RoutingKey:{User:value} when invoking a function through invoke for invocation based on rule matching.
    method string
    Match method. Valid values:range: Range matchexact: exact string match.
    version string
    Function version name.
    expression str
    Rule requirements for range match:It should be described in an open or closed range, i.e., (a,b) or [a,b], where both a and b are integersRule requirements for exact match:Exact string match.
    key str
    Matching rule key. When the API is called, pass in the key to route the request to the specified version based on the matching ruleHeader method:Enter invoke.headers.User for key and pass in RoutingKey:{User:value} when invoking a function through invoke for invocation based on rule matching.
    method str
    Match method. Valid values:range: Range matchexact: exact string match.
    version str
    Function version name.
    expression String
    Rule requirements for range match:It should be described in an open or closed range, i.e., (a,b) or [a,b], where both a and b are integersRule requirements for exact match:Exact string match.
    key String
    Matching rule key. When the API is called, pass in the key to route the request to the specified version based on the matching ruleHeader method:Enter invoke.headers.User for key and pass in RoutingKey:{User:value} when invoking a function through invoke for invocation based on rule matching.
    method String
    Match method. Valid values:range: Range matchexact: exact string match.
    version String
    Function version name.

    ScfFunctionAliasRoutingConfigAdditionalVersionWeight, ScfFunctionAliasRoutingConfigAdditionalVersionWeightArgs

    Version string
    Function version name.
    Weight double
    Version weight.
    Version string
    Function version name.
    Weight float64
    Version weight.
    version String
    Function version name.
    weight Double
    Version weight.
    version string
    Function version name.
    weight number
    Version weight.
    version str
    Function version name.
    weight float
    Version weight.
    version String
    Function version name.
    weight Number
    Version weight.

    Import

    scf function_alias can be imported using the id, e.g.

    $ pulumi import tencentcloud:index/scfFunctionAlias:ScfFunctionAlias function_alias namespace#functionName#name
    

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

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack