1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. esa
  5. CustomScenePolicy
Alibaba Cloud v3.83.0 published on Monday, Jul 21, 2025 by Pulumi

alicloud.esa.CustomScenePolicy

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.83.0 published on Monday, Jul 21, 2025 by Pulumi

    Provides a ESA Custom Scene Policy resource.

    For information about ESA Custom Scene Policy and how to use it, see What is Custom Scene Policy.

    NOTE: Available since v1.253.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "bcd58610.com";
    const _default = alicloud.esa.getSites({
        planSubscribeType: "enterpriseplan",
    });
    const defaultSite = new alicloud.esa.Site("default", {
        siteName: name,
        instanceId: _default.then(_default => _default.sites?.[0]?.instanceId),
        coverage: "overseas",
        accessType: "NS",
        versionManagement: true,
    });
    const defaultCustomScenePolicy = new alicloud.esa.CustomScenePolicy("default", {
        endTime: "2025-08-07T17:00:00Z",
        createTime: "2025-07-07T17:00:00Z",
        siteIds: defaultSite.id,
        template: "promotion",
        customScenePolicyName: "example-policy",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "bcd58610.com"
    default = alicloud.esa.get_sites(plan_subscribe_type="enterpriseplan")
    default_site = alicloud.esa.Site("default",
        site_name=name,
        instance_id=default.sites[0].instance_id,
        coverage="overseas",
        access_type="NS",
        version_management=True)
    default_custom_scene_policy = alicloud.esa.CustomScenePolicy("default",
        end_time="2025-08-07T17:00:00Z",
        create_time="2025-07-07T17:00:00Z",
        site_ids=default_site.id,
        template="promotion",
        custom_scene_policy_name="example-policy")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/esa"
    	"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 := "bcd58610.com"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := esa.GetSites(ctx, &esa.GetSitesArgs{
    			PlanSubscribeType: pulumi.StringRef("enterpriseplan"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultSite, err := esa.NewSite(ctx, "default", &esa.SiteArgs{
    			SiteName:          pulumi.String(name),
    			InstanceId:        pulumi.String(_default.Sites[0].InstanceId),
    			Coverage:          pulumi.String("overseas"),
    			AccessType:        pulumi.String("NS"),
    			VersionManagement: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = esa.NewCustomScenePolicy(ctx, "default", &esa.CustomScenePolicyArgs{
    			EndTime:               pulumi.String("2025-08-07T17:00:00Z"),
    			CreateTime:            pulumi.String("2025-07-07T17:00:00Z"),
    			SiteIds:               defaultSite.ID(),
    			Template:              pulumi.String("promotion"),
    			CustomScenePolicyName: pulumi.String("example-policy"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "bcd58610.com";
        var @default = AliCloud.Esa.GetSites.Invoke(new()
        {
            PlanSubscribeType = "enterpriseplan",
        });
    
        var defaultSite = new AliCloud.Esa.Site("default", new()
        {
            SiteName = name,
            InstanceId = @default.Apply(@default => @default.Apply(getSitesResult => getSitesResult.Sites[0]?.InstanceId)),
            Coverage = "overseas",
            AccessType = "NS",
            VersionManagement = true,
        });
    
        var defaultCustomScenePolicy = new AliCloud.Esa.CustomScenePolicy("default", new()
        {
            EndTime = "2025-08-07T17:00:00Z",
            CreateTime = "2025-07-07T17:00:00Z",
            SiteIds = defaultSite.Id,
            Template = "promotion",
            CustomScenePolicyName = "example-policy",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.esa.EsaFunctions;
    import com.pulumi.alicloud.esa.inputs.GetSitesArgs;
    import com.pulumi.alicloud.esa.Site;
    import com.pulumi.alicloud.esa.SiteArgs;
    import com.pulumi.alicloud.esa.CustomScenePolicy;
    import com.pulumi.alicloud.esa.CustomScenePolicyArgs;
    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("bcd58610.com");
            final var default = EsaFunctions.getSites(GetSitesArgs.builder()
                .planSubscribeType("enterpriseplan")
                .build());
    
            var defaultSite = new Site("defaultSite", SiteArgs.builder()
                .siteName(name)
                .instanceId(default_.sites()[0].instanceId())
                .coverage("overseas")
                .accessType("NS")
                .versionManagement(true)
                .build());
    
            var defaultCustomScenePolicy = new CustomScenePolicy("defaultCustomScenePolicy", CustomScenePolicyArgs.builder()
                .endTime("2025-08-07T17:00:00Z")
                .createTime("2025-07-07T17:00:00Z")
                .siteIds(defaultSite.id())
                .template("promotion")
                .customScenePolicyName("example-policy")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: bcd58610.com
    resources:
      defaultSite:
        type: alicloud:esa:Site
        name: default
        properties:
          siteName: ${name}
          instanceId: ${default.sites[0].instanceId}
          coverage: overseas
          accessType: NS
          versionManagement: true
      defaultCustomScenePolicy:
        type: alicloud:esa:CustomScenePolicy
        name: default
        properties:
          endTime: 2025-08-07T17:00:00Z
          createTime: 2025-07-07T17:00:00Z
          siteIds: ${defaultSite.id}
          template: promotion
          customScenePolicyName: example-policy
    variables:
      default:
        fn::invoke:
          function: alicloud:esa:getSites
          arguments:
            planSubscribeType: enterpriseplan
    

    Create CustomScenePolicy Resource

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

    Constructor syntax

    new CustomScenePolicy(name: string, args: CustomScenePolicyArgs, opts?: CustomResourceOptions);
    @overload
    def CustomScenePolicy(resource_name: str,
                          args: CustomScenePolicyArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def CustomScenePolicy(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          create_time: Optional[str] = None,
                          custom_scene_policy_name: Optional[str] = None,
                          end_time: Optional[str] = None,
                          site_ids: Optional[str] = None,
                          template: Optional[str] = None,
                          status: Optional[str] = None)
    func NewCustomScenePolicy(ctx *Context, name string, args CustomScenePolicyArgs, opts ...ResourceOption) (*CustomScenePolicy, error)
    public CustomScenePolicy(string name, CustomScenePolicyArgs args, CustomResourceOptions? opts = null)
    public CustomScenePolicy(String name, CustomScenePolicyArgs args)
    public CustomScenePolicy(String name, CustomScenePolicyArgs args, CustomResourceOptions options)
    
    type: alicloud:esa:CustomScenePolicy
    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 CustomScenePolicyArgs
    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 CustomScenePolicyArgs
    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 CustomScenePolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CustomScenePolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CustomScenePolicyArgs
    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 customScenePolicyResource = new AliCloud.Esa.CustomScenePolicy("customScenePolicyResource", new()
    {
        CreateTime = "string",
        CustomScenePolicyName = "string",
        EndTime = "string",
        SiteIds = "string",
        Template = "string",
        Status = "string",
    });
    
    example, err := esa.NewCustomScenePolicy(ctx, "customScenePolicyResource", &esa.CustomScenePolicyArgs{
    	CreateTime:            pulumi.String("string"),
    	CustomScenePolicyName: pulumi.String("string"),
    	EndTime:               pulumi.String("string"),
    	SiteIds:               pulumi.String("string"),
    	Template:              pulumi.String("string"),
    	Status:                pulumi.String("string"),
    })
    
    var customScenePolicyResource = new CustomScenePolicy("customScenePolicyResource", CustomScenePolicyArgs.builder()
        .createTime("string")
        .customScenePolicyName("string")
        .endTime("string")
        .siteIds("string")
        .template("string")
        .status("string")
        .build());
    
    custom_scene_policy_resource = alicloud.esa.CustomScenePolicy("customScenePolicyResource",
        create_time="string",
        custom_scene_policy_name="string",
        end_time="string",
        site_ids="string",
        template="string",
        status="string")
    
    const customScenePolicyResource = new alicloud.esa.CustomScenePolicy("customScenePolicyResource", {
        createTime: "string",
        customScenePolicyName: "string",
        endTime: "string",
        siteIds: "string",
        template: "string",
        status: "string",
    });
    
    type: alicloud:esa:CustomScenePolicy
    properties:
        createTime: string
        customScenePolicyName: string
        endTime: string
        siteIds: string
        status: string
        template: string
    

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

    CreateTime string
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    CustomScenePolicyName string
    The policy name.
    EndTime string
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    SiteIds string
    The IDs of websites associated.
    Template string
    The name of the policy template. Valid value:
    Status string
    Policy effective status. Valid values: Disabled, Running.
    CreateTime string
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    CustomScenePolicyName string
    The policy name.
    EndTime string
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    SiteIds string
    The IDs of websites associated.
    Template string
    The name of the policy template. Valid value:
    Status string
    Policy effective status. Valid values: Disabled, Running.
    createTime String
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    customScenePolicyName String
    The policy name.
    endTime String
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    siteIds String
    The IDs of websites associated.
    template String
    The name of the policy template. Valid value:
    status String
    Policy effective status. Valid values: Disabled, Running.
    createTime string
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    customScenePolicyName string
    The policy name.
    endTime string
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    siteIds string
    The IDs of websites associated.
    template string
    The name of the policy template. Valid value:
    status string
    Policy effective status. Valid values: Disabled, Running.
    create_time str
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    custom_scene_policy_name str
    The policy name.
    end_time str
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    site_ids str
    The IDs of websites associated.
    template str
    The name of the policy template. Valid value:
    status str
    Policy effective status. Valid values: Disabled, Running.
    createTime String
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    customScenePolicyName String
    The policy name.
    endTime String
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    siteIds String
    The IDs of websites associated.
    template String
    The name of the policy template. Valid value:
    status String
    Policy effective status. Valid values: Disabled, Running.

    Outputs

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

    Get an existing CustomScenePolicy 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?: CustomScenePolicyState, opts?: CustomResourceOptions): CustomScenePolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            create_time: Optional[str] = None,
            custom_scene_policy_name: Optional[str] = None,
            end_time: Optional[str] = None,
            site_ids: Optional[str] = None,
            status: Optional[str] = None,
            template: Optional[str] = None) -> CustomScenePolicy
    func GetCustomScenePolicy(ctx *Context, name string, id IDInput, state *CustomScenePolicyState, opts ...ResourceOption) (*CustomScenePolicy, error)
    public static CustomScenePolicy Get(string name, Input<string> id, CustomScenePolicyState? state, CustomResourceOptions? opts = null)
    public static CustomScenePolicy get(String name, Output<String> id, CustomScenePolicyState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:esa:CustomScenePolicy    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:
    CreateTime string
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    CustomScenePolicyName string
    The policy name.
    EndTime string
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    SiteIds string
    The IDs of websites associated.
    Status string
    Policy effective status. Valid values: Disabled, Running.
    Template string
    The name of the policy template. Valid value:
    CreateTime string
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    CustomScenePolicyName string
    The policy name.
    EndTime string
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    SiteIds string
    The IDs of websites associated.
    Status string
    Policy effective status. Valid values: Disabled, Running.
    Template string
    The name of the policy template. Valid value:
    createTime String
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    customScenePolicyName String
    The policy name.
    endTime String
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    siteIds String
    The IDs of websites associated.
    status String
    Policy effective status. Valid values: Disabled, Running.
    template String
    The name of the policy template. Valid value:
    createTime string
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    customScenePolicyName string
    The policy name.
    endTime string
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    siteIds string
    The IDs of websites associated.
    status string
    Policy effective status. Valid values: Disabled, Running.
    template string
    The name of the policy template. Valid value:
    create_time str
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    custom_scene_policy_name str
    The policy name.
    end_time str
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    site_ids str
    The IDs of websites associated.
    status str
    Policy effective status. Valid values: Disabled, Running.
    template str
    The name of the policy template. Valid value:
    createTime String
    The time when the policy takes effect. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    customScenePolicyName String
    The policy name.
    endTime String
    The time when the policy expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    siteIds String
    The IDs of websites associated.
    status String
    Policy effective status. Valid values: Disabled, Running.
    template String
    The name of the policy template. Valid value:

    Import

    ESA Custom Scene Policy can be imported using the id, e.g.

    $ pulumi import alicloud:esa/customScenePolicy:CustomScenePolicy example <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.83.0 published on Monday, Jul 21, 2025 by Pulumi