1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. sae
  5. Namespace
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.sae.Namespace

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    Provides a Serverless App Engine (SAE) Namespace resource.

    For information about SAE Namespace and how to use it, see What is Namespace.

    NOTE: Available since v1.129.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const default = alicloud.getRegions({
        current: true,
    });
    const defaultInteger = new random.index.Integer("default", {
        max: 99999,
        min: 10000,
    });
    const example = new alicloud.sae.Namespace("example", {
        namespaceId: _default.then(_default => `${_default.regions?.[0]?.id}:example${defaultInteger.result}`),
        namespaceName: name,
        namespaceDescription: name,
        enableMicroRegistration: false,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = alicloud.get_regions(current=True)
    default_integer = random.index.Integer("default",
        max=99999,
        min=10000)
    example = alicloud.sae.Namespace("example",
        namespace_id=f"{default.regions[0].id}:example{default_integer['result']}",
        namespace_name=name,
        namespace_description=name,
        enable_micro_registration=False)
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/sae"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"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
    		}
    		_default, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
    			Current: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultInteger, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Max: 99999,
    			Min: 10000,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = sae.NewNamespace(ctx, "example", &sae.NamespaceArgs{
    			NamespaceId:             pulumi.Sprintf("%v:example%v", _default.Regions[0].Id, defaultInteger.Result),
    			NamespaceName:           pulumi.String(name),
    			NamespaceDescription:    pulumi.String(name),
    			EnableMicroRegistration: pulumi.Bool(false),
    		})
    		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 config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = AliCloud.GetRegions.Invoke(new()
        {
            Current = true,
        });
    
        var defaultInteger = new Random.Index.Integer("default", new()
        {
            Max = 99999,
            Min = 10000,
        });
    
        var example = new AliCloud.Sae.Namespace("example", new()
        {
            NamespaceId = @default.Apply(@default => $"{@default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}:example{defaultInteger.Result}"),
            NamespaceName = name,
            NamespaceDescription = name,
            EnableMicroRegistration = false,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetRegionsArgs;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    import com.pulumi.alicloud.sae.Namespace;
    import com.pulumi.alicloud.sae.NamespaceArgs;
    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");
            final var default = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
                .current(true)
                .build());
    
            var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
                .max(99999)
                .min(10000)
                .build());
    
            var example = new Namespace("example", NamespaceArgs.builder()
                .namespaceId(String.format("%s:example%s", default_.regions()[0].id(),defaultInteger.result()))
                .namespaceName(name)
                .namespaceDescription(name)
                .enableMicroRegistration(false)
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      defaultInteger:
        type: random:integer
        name: default
        properties:
          max: 99999
          min: 10000
      example:
        type: alicloud:sae:Namespace
        properties:
          namespaceId: ${default.regions[0].id}:example${defaultInteger.result}
          namespaceName: ${name}
          namespaceDescription: ${name}
          enableMicroRegistration: false
    variables:
      default:
        fn::invoke:
          Function: alicloud:getRegions
          Arguments:
            current: true
    

    Create Namespace Resource

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

    Constructor syntax

    new Namespace(name: string, args: NamespaceArgs, opts?: CustomResourceOptions);
    @overload
    def Namespace(resource_name: str,
                  args: NamespaceArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def Namespace(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  namespace_name: Optional[str] = None,
                  enable_micro_registration: Optional[bool] = None,
                  namespace_description: Optional[str] = None,
                  namespace_id: Optional[str] = None,
                  namespace_short_id: Optional[str] = None)
    func NewNamespace(ctx *Context, name string, args NamespaceArgs, opts ...ResourceOption) (*Namespace, error)
    public Namespace(string name, NamespaceArgs args, CustomResourceOptions? opts = null)
    public Namespace(String name, NamespaceArgs args)
    public Namespace(String name, NamespaceArgs args, CustomResourceOptions options)
    
    type: alicloud:sae:Namespace
    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 NamespaceArgs
    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 NamespaceArgs
    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 NamespaceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NamespaceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NamespaceArgs
    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 examplenamespaceResourceResourceFromSaenamespace = new AliCloud.Sae.Namespace("examplenamespaceResourceResourceFromSaenamespace", new()
    {
        NamespaceName = "string",
        EnableMicroRegistration = false,
        NamespaceDescription = "string",
        NamespaceId = "string",
        NamespaceShortId = "string",
    });
    
    example, err := sae.NewNamespace(ctx, "examplenamespaceResourceResourceFromSaenamespace", &sae.NamespaceArgs{
    	NamespaceName:           pulumi.String("string"),
    	EnableMicroRegistration: pulumi.Bool(false),
    	NamespaceDescription:    pulumi.String("string"),
    	NamespaceId:             pulumi.String("string"),
    	NamespaceShortId:        pulumi.String("string"),
    })
    
    var examplenamespaceResourceResourceFromSaenamespace = new Namespace("examplenamespaceResourceResourceFromSaenamespace", NamespaceArgs.builder()
        .namespaceName("string")
        .enableMicroRegistration(false)
        .namespaceDescription("string")
        .namespaceId("string")
        .namespaceShortId("string")
        .build());
    
    examplenamespace_resource_resource_from_saenamespace = alicloud.sae.Namespace("examplenamespaceResourceResourceFromSaenamespace",
        namespace_name="string",
        enable_micro_registration=False,
        namespace_description="string",
        namespace_id="string",
        namespace_short_id="string")
    
    const examplenamespaceResourceResourceFromSaenamespace = new alicloud.sae.Namespace("examplenamespaceResourceResourceFromSaenamespace", {
        namespaceName: "string",
        enableMicroRegistration: false,
        namespaceDescription: "string",
        namespaceId: "string",
        namespaceShortId: "string",
    });
    
    type: alicloud:sae:Namespace
    properties:
        enableMicroRegistration: false
        namespaceDescription: string
        namespaceId: string
        namespaceName: string
        namespaceShortId: string
    

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

    NamespaceName string
    The Name of Namespace.
    EnableMicroRegistration bool
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    NamespaceDescription string
    The Description of Namespace.
    NamespaceId string
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    NamespaceShortId string
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.
    NamespaceName string
    The Name of Namespace.
    EnableMicroRegistration bool
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    NamespaceDescription string
    The Description of Namespace.
    NamespaceId string
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    NamespaceShortId string
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.
    namespaceName String
    The Name of Namespace.
    enableMicroRegistration Boolean
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    namespaceDescription String
    The Description of Namespace.
    namespaceId String
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    namespaceShortId String
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.
    namespaceName string
    The Name of Namespace.
    enableMicroRegistration boolean
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    namespaceDescription string
    The Description of Namespace.
    namespaceId string
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    namespaceShortId string
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.
    namespace_name str
    The Name of Namespace.
    enable_micro_registration bool
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    namespace_description str
    The Description of Namespace.
    namespace_id str
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    namespace_short_id str
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.
    namespaceName String
    The Name of Namespace.
    enableMicroRegistration Boolean
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    namespaceDescription String
    The Description of Namespace.
    namespaceId String
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    namespaceShortId String
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.

    Outputs

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

    Get an existing Namespace 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?: NamespaceState, opts?: CustomResourceOptions): Namespace
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            enable_micro_registration: Optional[bool] = None,
            namespace_description: Optional[str] = None,
            namespace_id: Optional[str] = None,
            namespace_name: Optional[str] = None,
            namespace_short_id: Optional[str] = None) -> Namespace
    func GetNamespace(ctx *Context, name string, id IDInput, state *NamespaceState, opts ...ResourceOption) (*Namespace, error)
    public static Namespace Get(string name, Input<string> id, NamespaceState? state, CustomResourceOptions? opts = null)
    public static Namespace get(String name, Output<String> id, NamespaceState 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:
    EnableMicroRegistration bool
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    NamespaceDescription string
    The Description of Namespace.
    NamespaceId string
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    NamespaceName string
    The Name of Namespace.
    NamespaceShortId string
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.
    EnableMicroRegistration bool
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    NamespaceDescription string
    The Description of Namespace.
    NamespaceId string
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    NamespaceName string
    The Name of Namespace.
    NamespaceShortId string
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.
    enableMicroRegistration Boolean
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    namespaceDescription String
    The Description of Namespace.
    namespaceId String
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    namespaceName String
    The Name of Namespace.
    namespaceShortId String
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.
    enableMicroRegistration boolean
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    namespaceDescription string
    The Description of Namespace.
    namespaceId string
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    namespaceName string
    The Name of Namespace.
    namespaceShortId string
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.
    enable_micro_registration bool
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    namespace_description str
    The Description of Namespace.
    namespace_id str
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    namespace_name str
    The Name of Namespace.
    namespace_short_id str
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.
    enableMicroRegistration Boolean
    Specifies whether to enable the SAE built-in registry. If you do not use the built-in registry, you can set enable_micro_registration to false to accelerate the creation of the namespace. Default value: true. Valid values:
    namespaceDescription String
    The Description of Namespace.
    namespaceId String
    The ID of the Namespace. It can contain 2 to 32 lowercase characters. The value is in format {RegionId}:{namespace}.
    namespaceName String
    The Name of Namespace.
    namespaceShortId String
    The short ID of the Namespace. You do not need to specify a region ID. The value of namespace_short_id can be up to 20 characters in length and can contain only lowercase letters and digits.

    Import

    Serverless App Engine (SAE) Namespace can be imported using the id, e.g.

    $ pulumi import alicloud:sae/namespace:Namespace example <namespace_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.66.0 published on Friday, Nov 15, 2024 by Pulumi