1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. R2BucketLifecycle
Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi

cloudflare.R2BucketLifecycle

Explore with Pulumi AI

cloudflare logo
Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi

    Example Usage

    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    resources:
      exampleR2BucketLifecycle:
        type: cloudflare:R2BucketLifecycle
        name: example_r2_bucket_lifecycle
        properties:
          accountId: 023e105f4ecef8ad9ca31a8372d0c353
          bucketName: example-bucket
          rules:
            - id: Expire all objects older than 24 hours
              conditions:
                prefix: prefix
              enabled: true
              abort_multipart_uploads_transition:
                condition:
                  maxAge: 0
                  type: Age
              delete_objects_transition:
                condition:
                  maxAge: 0
                  type: Age
              storage_class_transitions:
                - condition:
                    maxAge: 0
                    type: Age
                  storageClass: InfrequentAccess
    

    Create R2BucketLifecycle Resource

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

    Constructor syntax

    new R2BucketLifecycle(name: string, args: R2BucketLifecycleArgs, opts?: CustomResourceOptions);
    @overload
    def R2BucketLifecycle(resource_name: str,
                          args: R2BucketLifecycleArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def R2BucketLifecycle(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          account_id: Optional[str] = None,
                          bucket_name: Optional[str] = None,
                          jurisdiction: Optional[str] = None,
                          rules: Optional[Sequence[R2BucketLifecycleRuleArgs]] = None)
    func NewR2BucketLifecycle(ctx *Context, name string, args R2BucketLifecycleArgs, opts ...ResourceOption) (*R2BucketLifecycle, error)
    public R2BucketLifecycle(string name, R2BucketLifecycleArgs args, CustomResourceOptions? opts = null)
    public R2BucketLifecycle(String name, R2BucketLifecycleArgs args)
    public R2BucketLifecycle(String name, R2BucketLifecycleArgs args, CustomResourceOptions options)
    
    type: cloudflare:R2BucketLifecycle
    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 R2BucketLifecycleArgs
    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 R2BucketLifecycleArgs
    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 R2BucketLifecycleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args R2BucketLifecycleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args R2BucketLifecycleArgs
    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 r2bucketLifecycleResource = new Cloudflare.R2BucketLifecycle("r2bucketLifecycleResource", new()
    {
        AccountId = "string",
        BucketName = "string",
        Jurisdiction = "string",
        Rules = new[]
        {
            new Cloudflare.Inputs.R2BucketLifecycleRuleArgs
            {
                Conditions = new Cloudflare.Inputs.R2BucketLifecycleRuleConditionsArgs
                {
                    Prefix = "string",
                },
                Enabled = false,
                Id = "string",
                AbortMultipartUploadsTransition = new Cloudflare.Inputs.R2BucketLifecycleRuleAbortMultipartUploadsTransitionArgs
                {
                    Condition = new Cloudflare.Inputs.R2BucketLifecycleRuleAbortMultipartUploadsTransitionConditionArgs
                    {
                        MaxAge = 0,
                        Type = "string",
                    },
                },
                DeleteObjectsTransition = new Cloudflare.Inputs.R2BucketLifecycleRuleDeleteObjectsTransitionArgs
                {
                    Condition = new Cloudflare.Inputs.R2BucketLifecycleRuleDeleteObjectsTransitionConditionArgs
                    {
                        Type = "string",
                        Date = "string",
                        MaxAge = 0,
                    },
                },
                StorageClassTransitions = new[]
                {
                    new Cloudflare.Inputs.R2BucketLifecycleRuleStorageClassTransitionArgs
                    {
                        Condition = new Cloudflare.Inputs.R2BucketLifecycleRuleStorageClassTransitionConditionArgs
                        {
                            Type = "string",
                            Date = "string",
                            MaxAge = 0,
                        },
                        StorageClass = "string",
                    },
                },
            },
        },
    });
    
    example, err := cloudflare.NewR2BucketLifecycle(ctx, "r2bucketLifecycleResource", &cloudflare.R2BucketLifecycleArgs{
    	AccountId:    pulumi.String("string"),
    	BucketName:   pulumi.String("string"),
    	Jurisdiction: pulumi.String("string"),
    	Rules: cloudflare.R2BucketLifecycleRuleArray{
    		&cloudflare.R2BucketLifecycleRuleArgs{
    			Conditions: &cloudflare.R2BucketLifecycleRuleConditionsArgs{
    				Prefix: pulumi.String("string"),
    			},
    			Enabled: pulumi.Bool(false),
    			Id:      pulumi.String("string"),
    			AbortMultipartUploadsTransition: &cloudflare.R2BucketLifecycleRuleAbortMultipartUploadsTransitionArgs{
    				Condition: &cloudflare.R2BucketLifecycleRuleAbortMultipartUploadsTransitionConditionArgs{
    					MaxAge: pulumi.Int(0),
    					Type:   pulumi.String("string"),
    				},
    			},
    			DeleteObjectsTransition: &cloudflare.R2BucketLifecycleRuleDeleteObjectsTransitionArgs{
    				Condition: &cloudflare.R2BucketLifecycleRuleDeleteObjectsTransitionConditionArgs{
    					Type:   pulumi.String("string"),
    					Date:   pulumi.String("string"),
    					MaxAge: pulumi.Int(0),
    				},
    			},
    			StorageClassTransitions: cloudflare.R2BucketLifecycleRuleStorageClassTransitionArray{
    				&cloudflare.R2BucketLifecycleRuleStorageClassTransitionArgs{
    					Condition: &cloudflare.R2BucketLifecycleRuleStorageClassTransitionConditionArgs{
    						Type:   pulumi.String("string"),
    						Date:   pulumi.String("string"),
    						MaxAge: pulumi.Int(0),
    					},
    					StorageClass: pulumi.String("string"),
    				},
    			},
    		},
    	},
    })
    
    var r2bucketLifecycleResource = new R2BucketLifecycle("r2bucketLifecycleResource", R2BucketLifecycleArgs.builder()
        .accountId("string")
        .bucketName("string")
        .jurisdiction("string")
        .rules(R2BucketLifecycleRuleArgs.builder()
            .conditions(R2BucketLifecycleRuleConditionsArgs.builder()
                .prefix("string")
                .build())
            .enabled(false)
            .id("string")
            .abortMultipartUploadsTransition(R2BucketLifecycleRuleAbortMultipartUploadsTransitionArgs.builder()
                .condition(R2BucketLifecycleRuleAbortMultipartUploadsTransitionConditionArgs.builder()
                    .maxAge(0)
                    .type("string")
                    .build())
                .build())
            .deleteObjectsTransition(R2BucketLifecycleRuleDeleteObjectsTransitionArgs.builder()
                .condition(R2BucketLifecycleRuleDeleteObjectsTransitionConditionArgs.builder()
                    .type("string")
                    .date("string")
                    .maxAge(0)
                    .build())
                .build())
            .storageClassTransitions(R2BucketLifecycleRuleStorageClassTransitionArgs.builder()
                .condition(R2BucketLifecycleRuleStorageClassTransitionConditionArgs.builder()
                    .type("string")
                    .date("string")
                    .maxAge(0)
                    .build())
                .storageClass("string")
                .build())
            .build())
        .build());
    
    r2bucket_lifecycle_resource = cloudflare.R2BucketLifecycle("r2bucketLifecycleResource",
        account_id="string",
        bucket_name="string",
        jurisdiction="string",
        rules=[{
            "conditions": {
                "prefix": "string",
            },
            "enabled": False,
            "id": "string",
            "abort_multipart_uploads_transition": {
                "condition": {
                    "max_age": 0,
                    "type": "string",
                },
            },
            "delete_objects_transition": {
                "condition": {
                    "type": "string",
                    "date": "string",
                    "max_age": 0,
                },
            },
            "storage_class_transitions": [{
                "condition": {
                    "type": "string",
                    "date": "string",
                    "max_age": 0,
                },
                "storage_class": "string",
            }],
        }])
    
    const r2bucketLifecycleResource = new cloudflare.R2BucketLifecycle("r2bucketLifecycleResource", {
        accountId: "string",
        bucketName: "string",
        jurisdiction: "string",
        rules: [{
            conditions: {
                prefix: "string",
            },
            enabled: false,
            id: "string",
            abortMultipartUploadsTransition: {
                condition: {
                    maxAge: 0,
                    type: "string",
                },
            },
            deleteObjectsTransition: {
                condition: {
                    type: "string",
                    date: "string",
                    maxAge: 0,
                },
            },
            storageClassTransitions: [{
                condition: {
                    type: "string",
                    date: "string",
                    maxAge: 0,
                },
                storageClass: "string",
            }],
        }],
    });
    
    type: cloudflare:R2BucketLifecycle
    properties:
        accountId: string
        bucketName: string
        jurisdiction: string
        rules:
            - abortMultipartUploadsTransition:
                condition:
                    maxAge: 0
                    type: string
              conditions:
                prefix: string
              deleteObjectsTransition:
                condition:
                    date: string
                    maxAge: 0
                    type: string
              enabled: false
              id: string
              storageClassTransitions:
                - condition:
                    date: string
                    maxAge: 0
                    type: string
                  storageClass: string
    

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

    AccountId string
    Account ID
    BucketName string
    Name of the bucket
    Jurisdiction string
    Jurisdiction of the bucket
    Rules List<R2BucketLifecycleRule>
    AccountId string
    Account ID
    BucketName string
    Name of the bucket
    Jurisdiction string
    Jurisdiction of the bucket
    Rules []R2BucketLifecycleRuleArgs
    accountId String
    Account ID
    bucketName String
    Name of the bucket
    jurisdiction String
    Jurisdiction of the bucket
    rules List<R2BucketLifecycleRule>
    accountId string
    Account ID
    bucketName string
    Name of the bucket
    jurisdiction string
    Jurisdiction of the bucket
    rules R2BucketLifecycleRule[]
    account_id str
    Account ID
    bucket_name str
    Name of the bucket
    jurisdiction str
    Jurisdiction of the bucket
    rules Sequence[R2BucketLifecycleRuleArgs]
    accountId String
    Account ID
    bucketName String
    Name of the bucket
    jurisdiction String
    Jurisdiction of the bucket
    rules List<Property Map>

    Outputs

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

    Get an existing R2BucketLifecycle 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?: R2BucketLifecycleState, opts?: CustomResourceOptions): R2BucketLifecycle
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            bucket_name: Optional[str] = None,
            jurisdiction: Optional[str] = None,
            rules: Optional[Sequence[R2BucketLifecycleRuleArgs]] = None) -> R2BucketLifecycle
    func GetR2BucketLifecycle(ctx *Context, name string, id IDInput, state *R2BucketLifecycleState, opts ...ResourceOption) (*R2BucketLifecycle, error)
    public static R2BucketLifecycle Get(string name, Input<string> id, R2BucketLifecycleState? state, CustomResourceOptions? opts = null)
    public static R2BucketLifecycle get(String name, Output<String> id, R2BucketLifecycleState state, CustomResourceOptions options)
    resources:  _:    type: cloudflare:R2BucketLifecycle    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:
    AccountId string
    Account ID
    BucketName string
    Name of the bucket
    Jurisdiction string
    Jurisdiction of the bucket
    Rules List<R2BucketLifecycleRule>
    AccountId string
    Account ID
    BucketName string
    Name of the bucket
    Jurisdiction string
    Jurisdiction of the bucket
    Rules []R2BucketLifecycleRuleArgs
    accountId String
    Account ID
    bucketName String
    Name of the bucket
    jurisdiction String
    Jurisdiction of the bucket
    rules List<R2BucketLifecycleRule>
    accountId string
    Account ID
    bucketName string
    Name of the bucket
    jurisdiction string
    Jurisdiction of the bucket
    rules R2BucketLifecycleRule[]
    account_id str
    Account ID
    bucket_name str
    Name of the bucket
    jurisdiction str
    Jurisdiction of the bucket
    rules Sequence[R2BucketLifecycleRuleArgs]
    accountId String
    Account ID
    bucketName String
    Name of the bucket
    jurisdiction String
    Jurisdiction of the bucket
    rules List<Property Map>

    Supporting Types

    R2BucketLifecycleRule, R2BucketLifecycleRuleArgs

    Conditions R2BucketLifecycleRuleConditions
    Conditions that apply to all transitions of this rule
    Enabled bool
    Whether or not this rule is in effect
    Id string
    Unique identifier for this rule
    AbortMultipartUploadsTransition R2BucketLifecycleRuleAbortMultipartUploadsTransition
    Transition to abort ongoing multipart uploads
    DeleteObjectsTransition R2BucketLifecycleRuleDeleteObjectsTransition
    Transition to delete objects
    StorageClassTransitions List<R2BucketLifecycleRuleStorageClassTransition>
    Transitions to change the storage class of objects
    Conditions R2BucketLifecycleRuleConditions
    Conditions that apply to all transitions of this rule
    Enabled bool
    Whether or not this rule is in effect
    Id string
    Unique identifier for this rule
    AbortMultipartUploadsTransition R2BucketLifecycleRuleAbortMultipartUploadsTransition
    Transition to abort ongoing multipart uploads
    DeleteObjectsTransition R2BucketLifecycleRuleDeleteObjectsTransition
    Transition to delete objects
    StorageClassTransitions []R2BucketLifecycleRuleStorageClassTransition
    Transitions to change the storage class of objects
    conditions R2BucketLifecycleRuleConditions
    Conditions that apply to all transitions of this rule
    enabled Boolean
    Whether or not this rule is in effect
    id String
    Unique identifier for this rule
    abortMultipartUploadsTransition R2BucketLifecycleRuleAbortMultipartUploadsTransition
    Transition to abort ongoing multipart uploads
    deleteObjectsTransition R2BucketLifecycleRuleDeleteObjectsTransition
    Transition to delete objects
    storageClassTransitions List<R2BucketLifecycleRuleStorageClassTransition>
    Transitions to change the storage class of objects
    conditions R2BucketLifecycleRuleConditions
    Conditions that apply to all transitions of this rule
    enabled boolean
    Whether or not this rule is in effect
    id string
    Unique identifier for this rule
    abortMultipartUploadsTransition R2BucketLifecycleRuleAbortMultipartUploadsTransition
    Transition to abort ongoing multipart uploads
    deleteObjectsTransition R2BucketLifecycleRuleDeleteObjectsTransition
    Transition to delete objects
    storageClassTransitions R2BucketLifecycleRuleStorageClassTransition[]
    Transitions to change the storage class of objects
    conditions R2BucketLifecycleRuleConditions
    Conditions that apply to all transitions of this rule
    enabled bool
    Whether or not this rule is in effect
    id str
    Unique identifier for this rule
    abort_multipart_uploads_transition R2BucketLifecycleRuleAbortMultipartUploadsTransition
    Transition to abort ongoing multipart uploads
    delete_objects_transition R2BucketLifecycleRuleDeleteObjectsTransition
    Transition to delete objects
    storage_class_transitions Sequence[R2BucketLifecycleRuleStorageClassTransition]
    Transitions to change the storage class of objects
    conditions Property Map
    Conditions that apply to all transitions of this rule
    enabled Boolean
    Whether or not this rule is in effect
    id String
    Unique identifier for this rule
    abortMultipartUploadsTransition Property Map
    Transition to abort ongoing multipart uploads
    deleteObjectsTransition Property Map
    Transition to delete objects
    storageClassTransitions List<Property Map>
    Transitions to change the storage class of objects

    R2BucketLifecycleRuleAbortMultipartUploadsTransition, R2BucketLifecycleRuleAbortMultipartUploadsTransitionArgs

    Condition R2BucketLifecycleRuleAbortMultipartUploadsTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    Condition R2BucketLifecycleRuleAbortMultipartUploadsTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    condition R2BucketLifecycleRuleAbortMultipartUploadsTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    condition R2BucketLifecycleRuleAbortMultipartUploadsTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    condition R2BucketLifecycleRuleAbortMultipartUploadsTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    condition Property Map
    Condition for lifecycle transitions to apply after an object reaches an age in seconds

    R2BucketLifecycleRuleAbortMultipartUploadsTransitionCondition, R2BucketLifecycleRuleAbortMultipartUploadsTransitionConditionArgs

    MaxAge int
    Type string
    Available values: "Age".
    MaxAge int
    Type string
    Available values: "Age".
    maxAge Integer
    type String
    Available values: "Age".
    maxAge number
    type string
    Available values: "Age".
    max_age int
    type str
    Available values: "Age".
    maxAge Number
    type String
    Available values: "Age".

    R2BucketLifecycleRuleConditions, R2BucketLifecycleRuleConditionsArgs

    Prefix string
    Transitions will only apply to objects/uploads in the bucket that start with the given prefix, an empty prefix can be provided to scope rule to all objects/uploads
    Prefix string
    Transitions will only apply to objects/uploads in the bucket that start with the given prefix, an empty prefix can be provided to scope rule to all objects/uploads
    prefix String
    Transitions will only apply to objects/uploads in the bucket that start with the given prefix, an empty prefix can be provided to scope rule to all objects/uploads
    prefix string
    Transitions will only apply to objects/uploads in the bucket that start with the given prefix, an empty prefix can be provided to scope rule to all objects/uploads
    prefix str
    Transitions will only apply to objects/uploads in the bucket that start with the given prefix, an empty prefix can be provided to scope rule to all objects/uploads
    prefix String
    Transitions will only apply to objects/uploads in the bucket that start with the given prefix, an empty prefix can be provided to scope rule to all objects/uploads

    R2BucketLifecycleRuleDeleteObjectsTransition, R2BucketLifecycleRuleDeleteObjectsTransitionArgs

    Condition R2BucketLifecycleRuleDeleteObjectsTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    Condition R2BucketLifecycleRuleDeleteObjectsTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    condition R2BucketLifecycleRuleDeleteObjectsTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    condition R2BucketLifecycleRuleDeleteObjectsTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    condition R2BucketLifecycleRuleDeleteObjectsTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    condition Property Map
    Condition for lifecycle transitions to apply after an object reaches an age in seconds

    R2BucketLifecycleRuleDeleteObjectsTransitionCondition, R2BucketLifecycleRuleDeleteObjectsTransitionConditionArgs

    Type string
    Available values: "Age".
    Date string
    MaxAge int
    Type string
    Available values: "Age".
    Date string
    MaxAge int
    type String
    Available values: "Age".
    date String
    maxAge Integer
    type string
    Available values: "Age".
    date string
    maxAge number
    type str
    Available values: "Age".
    date str
    max_age int
    type String
    Available values: "Age".
    date String
    maxAge Number

    R2BucketLifecycleRuleStorageClassTransition, R2BucketLifecycleRuleStorageClassTransitionArgs

    Condition R2BucketLifecycleRuleStorageClassTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    StorageClass string
    Available values: "InfrequentAccess".
    Condition R2BucketLifecycleRuleStorageClassTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    StorageClass string
    Available values: "InfrequentAccess".
    condition R2BucketLifecycleRuleStorageClassTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    storageClass String
    Available values: "InfrequentAccess".
    condition R2BucketLifecycleRuleStorageClassTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    storageClass string
    Available values: "InfrequentAccess".
    condition R2BucketLifecycleRuleStorageClassTransitionCondition
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    storage_class str
    Available values: "InfrequentAccess".
    condition Property Map
    Condition for lifecycle transitions to apply after an object reaches an age in seconds
    storageClass String
    Available values: "InfrequentAccess".

    R2BucketLifecycleRuleStorageClassTransitionCondition, R2BucketLifecycleRuleStorageClassTransitionConditionArgs

    Type string
    Available values: "Age".
    Date string
    MaxAge int
    Type string
    Available values: "Age".
    Date string
    MaxAge int
    type String
    Available values: "Age".
    date String
    maxAge Integer
    type string
    Available values: "Age".
    date string
    maxAge number
    type str
    Available values: "Age".
    date str
    max_age int
    type String
    Available values: "Age".
    date String
    maxAge Number

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi