1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. fc
  5. Alias
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.fc.Alias

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    Creates a Function Compute service alias. Creates an alias that points to the specified Function Compute service version. For the detailed information, please refer to the developer guide.

    NOTE: Available since v1.104.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const _default = new random.index.Integer("default", {
        max: 99999,
        min: 10000,
    });
    const defaultService = new alicloud.fc.Service("default", {
        name: `example-value-${_default.result}`,
        description: "example-value",
        publish: true,
    });
    const example = new alicloud.fc.Alias("example", {
        aliasName: "example-value",
        description: "example-value",
        serviceName: defaultService.name,
        serviceVersion: "1",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    default = random.index.Integer("default",
        max=99999,
        min=10000)
    default_service = alicloud.fc.Service("default",
        name=f"example-value-{default['result']}",
        description="example-value",
        publish=True)
    example = alicloud.fc.Alias("example",
        alias_name="example-value",
        description="example-value",
        service_name=default_service.name,
        service_version="1")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/fc"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Max: 99999,
    			Min: 10000,
    		})
    		if err != nil {
    			return err
    		}
    		defaultService, err := fc.NewService(ctx, "default", &fc.ServiceArgs{
    			Name:        pulumi.String(fmt.Sprintf("example-value-%v", _default.Result)),
    			Description: pulumi.String("example-value"),
    			Publish:     pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = fc.NewAlias(ctx, "example", &fc.AliasArgs{
    			AliasName:      pulumi.String("example-value"),
    			Description:    pulumi.String("example-value"),
    			ServiceName:    defaultService.Name,
    			ServiceVersion: pulumi.String("1"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Random.Index.Integer("default", new()
        {
            Max = 99999,
            Min = 10000,
        });
    
        var defaultService = new AliCloud.FC.Service("default", new()
        {
            Name = $"example-value-{@default.Result}",
            Description = "example-value",
            Publish = true,
        });
    
        var example = new AliCloud.FC.Alias("example", new()
        {
            AliasName = "example-value",
            Description = "example-value",
            ServiceName = defaultService.Name,
            ServiceVersion = "1",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    import com.pulumi.alicloud.fc.Service;
    import com.pulumi.alicloud.fc.ServiceArgs;
    import com.pulumi.alicloud.fc.Alias;
    import com.pulumi.alicloud.fc.AliasArgs;
    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) {
            var default_ = new Integer("default", IntegerArgs.builder()
                .max(99999)
                .min(10000)
                .build());
    
            var defaultService = new Service("defaultService", ServiceArgs.builder()
                .name(String.format("example-value-%s", default_.result()))
                .description("example-value")
                .publish("true")
                .build());
    
            var example = new Alias("example", AliasArgs.builder()
                .aliasName("example-value")
                .description("example-value")
                .serviceName(defaultService.name())
                .serviceVersion("1")
                .build());
    
        }
    }
    
    resources:
      default:
        type: random:integer
        properties:
          max: 99999
          min: 10000
      defaultService:
        type: alicloud:fc:Service
        name: default
        properties:
          name: example-value-${default.result}
          description: example-value
          publish: 'true'
      example:
        type: alicloud:fc:Alias
        properties:
          aliasName: example-value
          description: example-value
          serviceName: ${defaultService.name}
          serviceVersion: '1'
    

    Create Alias Resource

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

    Constructor syntax

    new Alias(name: string, args: AliasArgs, opts?: CustomResourceOptions);
    @overload
    def Alias(resource_name: str,
              args: AliasArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Alias(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              alias_name: Optional[str] = None,
              service_name: Optional[str] = None,
              service_version: Optional[str] = None,
              description: Optional[str] = None,
              routing_config: Optional[AliasRoutingConfigArgs] = None)
    func NewAlias(ctx *Context, name string, args AliasArgs, opts ...ResourceOption) (*Alias, error)
    public Alias(string name, AliasArgs args, CustomResourceOptions? opts = null)
    public Alias(String name, AliasArgs args)
    public Alias(String name, AliasArgs args, CustomResourceOptions options)
    
    type: alicloud:fc:Alias
    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 AliasArgs
    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 AliasArgs
    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 AliasArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AliasArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AliasArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var aliasResource = new AliCloud.FC.Alias("aliasResource", new()
    {
        AliasName = "string",
        ServiceName = "string",
        ServiceVersion = "string",
        Description = "string",
        RoutingConfig = new AliCloud.FC.Inputs.AliasRoutingConfigArgs
        {
            AdditionalVersionWeights = 
            {
                { "string", 0 },
            },
        },
    });
    
    example, err := fc.NewAlias(ctx, "aliasResource", &fc.AliasArgs{
    	AliasName:      pulumi.String("string"),
    	ServiceName:    pulumi.String("string"),
    	ServiceVersion: pulumi.String("string"),
    	Description:    pulumi.String("string"),
    	RoutingConfig: &fc.AliasRoutingConfigArgs{
    		AdditionalVersionWeights: pulumi.Float64Map{
    			"string": pulumi.Float64(0),
    		},
    	},
    })
    
    var aliasResource = new Alias("aliasResource", AliasArgs.builder()
        .aliasName("string")
        .serviceName("string")
        .serviceVersion("string")
        .description("string")
        .routingConfig(AliasRoutingConfigArgs.builder()
            .additionalVersionWeights(Map.of("string", 0))
            .build())
        .build());
    
    alias_resource = alicloud.fc.Alias("aliasResource",
        alias_name="string",
        service_name="string",
        service_version="string",
        description="string",
        routing_config=alicloud.fc.AliasRoutingConfigArgs(
            additional_version_weights={
                "string": 0,
            },
        ))
    
    const aliasResource = new alicloud.fc.Alias("aliasResource", {
        aliasName: "string",
        serviceName: "string",
        serviceVersion: "string",
        description: "string",
        routingConfig: {
            additionalVersionWeights: {
                string: 0,
            },
        },
    });
    
    type: alicloud:fc:Alias
    properties:
        aliasName: string
        description: string
        routingConfig:
            additionalVersionWeights:
                string: 0
        serviceName: string
        serviceVersion: string
    

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

    AliasName string
    Name for the alias you are creating.
    ServiceName string
    The Function Compute service name.
    ServiceVersion string
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    Description string
    Description of the alias.
    RoutingConfig Pulumi.AliCloud.FC.Inputs.AliasRoutingConfig
    The Function Compute alias' route configuration settings. See routing_config below.
    AliasName string
    Name for the alias you are creating.
    ServiceName string
    The Function Compute service name.
    ServiceVersion string
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    Description string
    Description of the alias.
    RoutingConfig AliasRoutingConfigArgs
    The Function Compute alias' route configuration settings. See routing_config below.
    aliasName String
    Name for the alias you are creating.
    serviceName String
    The Function Compute service name.
    serviceVersion String
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    description String
    Description of the alias.
    routingConfig AliasRoutingConfig
    The Function Compute alias' route configuration settings. See routing_config below.
    aliasName string
    Name for the alias you are creating.
    serviceName string
    The Function Compute service name.
    serviceVersion string
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    description string
    Description of the alias.
    routingConfig AliasRoutingConfig
    The Function Compute alias' route configuration settings. See routing_config below.
    alias_name str
    Name for the alias you are creating.
    service_name str
    The Function Compute service name.
    service_version str
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    description str
    Description of the alias.
    routing_config AliasRoutingConfigArgs
    The Function Compute alias' route configuration settings. See routing_config below.
    aliasName String
    Name for the alias you are creating.
    serviceName String
    The Function Compute service name.
    serviceVersion String
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    description String
    Description of the alias.
    routingConfig Property Map
    The Function Compute alias' route configuration settings. See routing_config below.

    Outputs

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

    Get an existing Alias 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?: AliasState, opts?: CustomResourceOptions): Alias
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            alias_name: Optional[str] = None,
            description: Optional[str] = None,
            routing_config: Optional[AliasRoutingConfigArgs] = None,
            service_name: Optional[str] = None,
            service_version: Optional[str] = None) -> Alias
    func GetAlias(ctx *Context, name string, id IDInput, state *AliasState, opts ...ResourceOption) (*Alias, error)
    public static Alias Get(string name, Input<string> id, AliasState? state, CustomResourceOptions? opts = null)
    public static Alias get(String name, Output<String> id, AliasState 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:
    AliasName string
    Name for the alias you are creating.
    Description string
    Description of the alias.
    RoutingConfig Pulumi.AliCloud.FC.Inputs.AliasRoutingConfig
    The Function Compute alias' route configuration settings. See routing_config below.
    ServiceName string
    The Function Compute service name.
    ServiceVersion string
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    AliasName string
    Name for the alias you are creating.
    Description string
    Description of the alias.
    RoutingConfig AliasRoutingConfigArgs
    The Function Compute alias' route configuration settings. See routing_config below.
    ServiceName string
    The Function Compute service name.
    ServiceVersion string
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    aliasName String
    Name for the alias you are creating.
    description String
    Description of the alias.
    routingConfig AliasRoutingConfig
    The Function Compute alias' route configuration settings. See routing_config below.
    serviceName String
    The Function Compute service name.
    serviceVersion String
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    aliasName string
    Name for the alias you are creating.
    description string
    Description of the alias.
    routingConfig AliasRoutingConfig
    The Function Compute alias' route configuration settings. See routing_config below.
    serviceName string
    The Function Compute service name.
    serviceVersion string
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    alias_name str
    Name for the alias you are creating.
    description str
    Description of the alias.
    routing_config AliasRoutingConfigArgs
    The Function Compute alias' route configuration settings. See routing_config below.
    service_name str
    The Function Compute service name.
    service_version str
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).
    aliasName String
    Name for the alias you are creating.
    description String
    Description of the alias.
    routingConfig Property Map
    The Function Compute alias' route configuration settings. See routing_config below.
    serviceName String
    The Function Compute service name.
    serviceVersion String
    The Function Compute service version for which you are creating the alias. Pattern: (LATEST|[0-9]+).

    Supporting Types

    AliasRoutingConfig, AliasRoutingConfigArgs

    AdditionalVersionWeights Dictionary<string, double>
    A map that defines the proportion of events that should be sent to different versions of a Function Compute service.
    AdditionalVersionWeights map[string]float64
    A map that defines the proportion of events that should be sent to different versions of a Function Compute service.
    additionalVersionWeights Map<String,Double>
    A map that defines the proportion of events that should be sent to different versions of a Function Compute service.
    additionalVersionWeights {[key: string]: number}
    A map that defines the proportion of events that should be sent to different versions of a Function Compute service.
    additional_version_weights Mapping[str, float]
    A map that defines the proportion of events that should be sent to different versions of a Function Compute service.
    additionalVersionWeights Map<Number>
    A map that defines the proportion of events that should be sent to different versions of a Function Compute service.

    Import

    Function Compute alias can be imported using the id, e.g.

    $ pulumi import alicloud:fc/alias:Alias example my_alias_id
    

    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.57.1 published on Wednesday, Jun 26, 2024 by Pulumi