1. Registry
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. ens
  6. getBucketLifecycles
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi

    This data source provides the ENS Bucket Lifecycle rules of the current Alibaba Cloud user.

    NOTE: Available since v1.291.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const _default = alicloud.ens.getBucketLifecycles({
        bucketName: "your-bucket-name",
    });
    export const lifecycleRuleId = _default.then(_default => _default.rules?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.ens.get_bucket_lifecycles(bucket_name="your-bucket-name")
    pulumi.export("lifecycleRuleId", default.rules[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ens"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_default, err := ens.GetBucketLifecycles(ctx, &ens.GetBucketLifecyclesArgs{
    			BucketName: "your-bucket-name",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("lifecycleRuleId", _default.Rules[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = AliCloud.Ens.GetBucketLifecycles.Invoke(new()
        {
            BucketName = "your-bucket-name",
        });
    
        return new Dictionary<string, object?>
        {
            ["lifecycleRuleId"] = @default.Apply(@default => @default.Apply(getBucketLifecyclesResult => getBucketLifecyclesResult.Rules[0]?.Id)),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ens.EnsFunctions;
    import com.pulumi.alicloud.ens.inputs.GetBucketLifecyclesArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 default = EnsFunctions.getBucketLifecycles(GetBucketLifecyclesArgs.builder()
                .bucketName("your-bucket-name")
                .build());
    
            ctx.export("lifecycleRuleId", default_.rules()[0].id());
        }
    }
    
    variables:
      default:
        fn::invoke:
          function: alicloud:ens:getBucketLifecycles
          arguments:
            bucketName: your-bucket-name
    outputs:
      lifecycleRuleId: ${default.rules[0].id}
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    data "alicloud_ens_getbucketlifecycles" "default" {
      bucket_name = "your-bucket-name"
    }
    
    output "lifecycleRuleId" {
      value = data.alicloud_ens_getbucketlifecycles.default.rules[0].id
    }
    

    Using getBucketLifecycles

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getBucketLifecycles(args: GetBucketLifecyclesArgs, opts?: InvokeOptions): Promise<GetBucketLifecyclesResult>
    function getBucketLifecyclesOutput(args: GetBucketLifecyclesOutputArgs, opts?: InvokeOutputOptions): Output<GetBucketLifecyclesResult>
    def get_bucket_lifecycles(bucket_name: Optional[str] = None,
                              output_file: Optional[str] = None,
                              rule_id: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetBucketLifecyclesResult
    def get_bucket_lifecycles_output(bucket_name: pulumi.Input[Optional[str]] = None,
                              output_file: pulumi.Input[Optional[str]] = None,
                              rule_id: pulumi.Input[Optional[str]] = None,
                              opts: Optional[InvokeOutputOptions] = None) -> Output[GetBucketLifecyclesResult]
    func GetBucketLifecycles(ctx *Context, args *GetBucketLifecyclesArgs, opts ...InvokeOption) (*GetBucketLifecyclesResult, error)
    func GetBucketLifecyclesOutput(ctx *Context, args *GetBucketLifecyclesOutputArgs, opts ...InvokeOption) GetBucketLifecyclesResultOutput

    > Note: This function is named GetBucketLifecycles in the Go SDK.

    public static class GetBucketLifecycles 
    {
        public static Task<GetBucketLifecyclesResult> InvokeAsync(GetBucketLifecyclesArgs args, InvokeOptions? opts = null)
        public static Output<GetBucketLifecyclesResult> Invoke(GetBucketLifecyclesInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetBucketLifecyclesResult> Invoke(GetBucketLifecyclesInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetBucketLifecyclesResult> getBucketLifecycles(GetBucketLifecyclesArgs args, InvokeOptions options)
    public static Output<GetBucketLifecyclesResult> getBucketLifecycles(GetBucketLifecyclesArgs args, InvokeOptions options)
    public static Output<GetBucketLifecyclesResult> getBucketLifecycles(GetBucketLifecyclesArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: alicloud:ens/getBucketLifecycles:getBucketLifecycles
      arguments:
        # arguments dictionary
    data "alicloud_ens_get_bucket_lifecycles" "name" {
        # arguments
    }

    The following arguments are supported:

    BucketName string
    The name of the ENS bucket whose lifecycle rules are to be listed.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RuleId string
    A specific rule ID used to filter results to a single rule.
    BucketName string
    The name of the ENS bucket whose lifecycle rules are to be listed.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RuleId string
    A specific rule ID used to filter results to a single rule.
    bucket_name string
    The name of the ENS bucket whose lifecycle rules are to be listed.
    output_file string
    File name where to save data source results (after running pulumi preview).
    rule_id string
    A specific rule ID used to filter results to a single rule.
    bucketName String
    The name of the ENS bucket whose lifecycle rules are to be listed.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    ruleId String
    A specific rule ID used to filter results to a single rule.
    bucketName string
    The name of the ENS bucket whose lifecycle rules are to be listed.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    ruleId string
    A specific rule ID used to filter results to a single rule.
    bucket_name str
    The name of the ENS bucket whose lifecycle rules are to be listed.
    output_file str
    File name where to save data source results (after running pulumi preview).
    rule_id str
    A specific rule ID used to filter results to a single rule.
    bucketName String
    The name of the ENS bucket whose lifecycle rules are to be listed.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    ruleId String
    A specific rule ID used to filter results to a single rule.

    getBucketLifecycles Result

    The following output properties are available:

    BucketName string
    The name of the ENS bucket.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of Bucket Lifecycle IDs, formatted as <bucket_name>:<rule_id>.
    Rules List<Pulumi.AliCloud.Ens.Outputs.GetBucketLifecyclesRule>
    A list of ENS Bucket Lifecycle rules. Each element contains the following attributes:
    OutputFile string
    RuleId string
    The unique ID of the rule.
    BucketName string
    The name of the ENS bucket.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of Bucket Lifecycle IDs, formatted as <bucket_name>:<rule_id>.
    Rules []GetBucketLifecyclesRule
    A list of ENS Bucket Lifecycle rules. Each element contains the following attributes:
    OutputFile string
    RuleId string
    The unique ID of the rule.
    bucket_name string
    The name of the ENS bucket.
    id string
    The provider-assigned unique ID for this managed resource.
    ids list(string)
    A list of Bucket Lifecycle IDs, formatted as <bucket_name>:<rule_id>.
    rules list(object)
    A list of ENS Bucket Lifecycle rules. Each element contains the following attributes:
    output_file string
    rule_id string
    The unique ID of the rule.
    bucketName String
    The name of the ENS bucket.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of Bucket Lifecycle IDs, formatted as <bucket_name>:<rule_id>.
    rules List<GetBucketLifecyclesRule>
    A list of ENS Bucket Lifecycle rules. Each element contains the following attributes:
    outputFile String
    ruleId String
    The unique ID of the rule.
    bucketName string
    The name of the ENS bucket.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of Bucket Lifecycle IDs, formatted as <bucket_name>:<rule_id>.
    rules GetBucketLifecyclesRule[]
    A list of ENS Bucket Lifecycle rules. Each element contains the following attributes:
    outputFile string
    ruleId string
    The unique ID of the rule.
    bucket_name str
    The name of the ENS bucket.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of Bucket Lifecycle IDs, formatted as <bucket_name>:<rule_id>.
    rules Sequence[GetBucketLifecyclesRule]
    A list of ENS Bucket Lifecycle rules. Each element contains the following attributes:
    output_file str
    rule_id str
    The unique ID of the rule.
    bucketName String
    The name of the ENS bucket.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of Bucket Lifecycle IDs, formatted as <bucket_name>:<rule_id>.
    rules List<Property Map>
    A list of ENS Bucket Lifecycle rules. Each element contains the following attributes:
    outputFile String
    ruleId String
    The unique ID of the rule.

    Supporting Types

    GetBucketLifecyclesRule

    BucketName string
    The name of the ENS bucket whose lifecycle rules are to be listed.
    ExpirationDays int
    The number of days after the last update of the object before the lifecycle rule takes effect.
    Id string
    The ID of the lifecycle rule, formatted as <bucket_name>:<rule_id>.
    Prefix string
    The prefix that the rule applies to.
    RuleId string
    A specific rule ID used to filter results to a single rule.
    Status string
    The rule status. Valid values: Enabled, Disabled.
    BucketName string
    The name of the ENS bucket whose lifecycle rules are to be listed.
    ExpirationDays int
    The number of days after the last update of the object before the lifecycle rule takes effect.
    Id string
    The ID of the lifecycle rule, formatted as <bucket_name>:<rule_id>.
    Prefix string
    The prefix that the rule applies to.
    RuleId string
    A specific rule ID used to filter results to a single rule.
    Status string
    The rule status. Valid values: Enabled, Disabled.
    bucket_name string
    The name of the ENS bucket whose lifecycle rules are to be listed.
    expiration_days number
    The number of days after the last update of the object before the lifecycle rule takes effect.
    id string
    The ID of the lifecycle rule, formatted as <bucket_name>:<rule_id>.
    prefix string
    The prefix that the rule applies to.
    rule_id string
    A specific rule ID used to filter results to a single rule.
    status string
    The rule status. Valid values: Enabled, Disabled.
    bucketName String
    The name of the ENS bucket whose lifecycle rules are to be listed.
    expirationDays Integer
    The number of days after the last update of the object before the lifecycle rule takes effect.
    id String
    The ID of the lifecycle rule, formatted as <bucket_name>:<rule_id>.
    prefix String
    The prefix that the rule applies to.
    ruleId String
    A specific rule ID used to filter results to a single rule.
    status String
    The rule status. Valid values: Enabled, Disabled.
    bucketName string
    The name of the ENS bucket whose lifecycle rules are to be listed.
    expirationDays number
    The number of days after the last update of the object before the lifecycle rule takes effect.
    id string
    The ID of the lifecycle rule, formatted as <bucket_name>:<rule_id>.
    prefix string
    The prefix that the rule applies to.
    ruleId string
    A specific rule ID used to filter results to a single rule.
    status string
    The rule status. Valid values: Enabled, Disabled.
    bucket_name str
    The name of the ENS bucket whose lifecycle rules are to be listed.
    expiration_days int
    The number of days after the last update of the object before the lifecycle rule takes effect.
    id str
    The ID of the lifecycle rule, formatted as <bucket_name>:<rule_id>.
    prefix str
    The prefix that the rule applies to.
    rule_id str
    A specific rule ID used to filter results to a single rule.
    status str
    The rule status. Valid values: Enabled, Disabled.
    bucketName String
    The name of the ENS bucket whose lifecycle rules are to be listed.
    expirationDays Number
    The number of days after the last update of the object before the lifecycle rule takes effect.
    id String
    The ID of the lifecycle rule, formatted as <bucket_name>:<rule_id>.
    prefix String
    The prefix that the rule applies to.
    ruleId String
    A specific rule ID used to filter results to a single rule.
    status String
    The rule status. Valid values: Enabled, Disabled.

    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 alicloud logo
    Viewing docs for Alibaba Cloud v3.108.0
    published on Thursday, Sep 17, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial