cloudflare.R2BucketLock
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const exampleR2BucketLock = new cloudflare.R2BucketLock("example_r2_bucket_lock", {
accountId: "023e105f4ecef8ad9ca31a8372d0c353",
bucketName: "example-bucket",
rules: [{
id: "Lock all objects for 24 hours",
condition: {
maxAgeSeconds: 100,
type: "Age",
},
enabled: true,
prefix: "prefix",
}],
});
import pulumi
import pulumi_cloudflare as cloudflare
example_r2_bucket_lock = cloudflare.R2BucketLock("example_r2_bucket_lock",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
bucket_name="example-bucket",
rules=[{
"id": "Lock all objects for 24 hours",
"condition": {
"max_age_seconds": 100,
"type": "Age",
},
"enabled": True,
"prefix": "prefix",
}])
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v6/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudflare.NewR2BucketLock(ctx, "example_r2_bucket_lock", &cloudflare.R2BucketLockArgs{
AccountId: pulumi.String("023e105f4ecef8ad9ca31a8372d0c353"),
BucketName: pulumi.String("example-bucket"),
Rules: cloudflare.R2BucketLockRuleArray{
&cloudflare.R2BucketLockRuleArgs{
Id: pulumi.String("Lock all objects for 24 hours"),
Condition: &cloudflare.R2BucketLockRuleConditionArgs{
MaxAgeSeconds: pulumi.Int(100),
Type: pulumi.String("Age"),
},
Enabled: pulumi.Bool(true),
Prefix: pulumi.String("prefix"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
return await Deployment.RunAsync(() =>
{
var exampleR2BucketLock = new Cloudflare.R2BucketLock("example_r2_bucket_lock", new()
{
AccountId = "023e105f4ecef8ad9ca31a8372d0c353",
BucketName = "example-bucket",
Rules = new[]
{
new Cloudflare.Inputs.R2BucketLockRuleArgs
{
Id = "Lock all objects for 24 hours",
Condition = new Cloudflare.Inputs.R2BucketLockRuleConditionArgs
{
MaxAgeSeconds = 100,
Type = "Age",
},
Enabled = true,
Prefix = "prefix",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.R2BucketLock;
import com.pulumi.cloudflare.R2BucketLockArgs;
import com.pulumi.cloudflare.inputs.R2BucketLockRuleArgs;
import com.pulumi.cloudflare.inputs.R2BucketLockRuleConditionArgs;
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 exampleR2BucketLock = new R2BucketLock("exampleR2BucketLock", R2BucketLockArgs.builder()
.accountId("023e105f4ecef8ad9ca31a8372d0c353")
.bucketName("example-bucket")
.rules(R2BucketLockRuleArgs.builder()
.id("Lock all objects for 24 hours")
.condition(R2BucketLockRuleConditionArgs.builder()
.maxAgeSeconds(100)
.type("Age")
.build())
.enabled(true)
.prefix("prefix")
.build())
.build());
}
}
resources:
exampleR2BucketLock:
type: cloudflare:R2BucketLock
name: example_r2_bucket_lock
properties:
accountId: 023e105f4ecef8ad9ca31a8372d0c353
bucketName: example-bucket
rules:
- id: Lock all objects for 24 hours
condition:
maxAgeSeconds: 100
type: Age
enabled: true
prefix: prefix
Create R2BucketLock Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new R2BucketLock(name: string, args: R2BucketLockArgs, opts?: CustomResourceOptions);
@overload
def R2BucketLock(resource_name: str,
args: R2BucketLockArgs,
opts: Optional[ResourceOptions] = None)
@overload
def R2BucketLock(resource_name: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[str] = None,
bucket_name: Optional[str] = None,
jurisdiction: Optional[str] = None,
rules: Optional[Sequence[R2BucketLockRuleArgs]] = None)
func NewR2BucketLock(ctx *Context, name string, args R2BucketLockArgs, opts ...ResourceOption) (*R2BucketLock, error)
public R2BucketLock(string name, R2BucketLockArgs args, CustomResourceOptions? opts = null)
public R2BucketLock(String name, R2BucketLockArgs args)
public R2BucketLock(String name, R2BucketLockArgs args, CustomResourceOptions options)
type: cloudflare:R2BucketLock
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 R2BucketLockArgs
- 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 R2BucketLockArgs
- 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 R2BucketLockArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args R2BucketLockArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args R2BucketLockArgs
- 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 r2bucketLockResource = new Cloudflare.R2BucketLock("r2bucketLockResource", new()
{
AccountId = "string",
BucketName = "string",
Jurisdiction = "string",
Rules = new[]
{
new Cloudflare.Inputs.R2BucketLockRuleArgs
{
Condition = new Cloudflare.Inputs.R2BucketLockRuleConditionArgs
{
Type = "string",
Date = "string",
MaxAgeSeconds = 0,
},
Enabled = false,
Id = "string",
Prefix = "string",
},
},
});
example, err := cloudflare.NewR2BucketLock(ctx, "r2bucketLockResource", &cloudflare.R2BucketLockArgs{
AccountId: pulumi.String("string"),
BucketName: pulumi.String("string"),
Jurisdiction: pulumi.String("string"),
Rules: cloudflare.R2BucketLockRuleArray{
&cloudflare.R2BucketLockRuleArgs{
Condition: &cloudflare.R2BucketLockRuleConditionArgs{
Type: pulumi.String("string"),
Date: pulumi.String("string"),
MaxAgeSeconds: pulumi.Int(0),
},
Enabled: pulumi.Bool(false),
Id: pulumi.String("string"),
Prefix: pulumi.String("string"),
},
},
})
var r2bucketLockResource = new R2BucketLock("r2bucketLockResource", R2BucketLockArgs.builder()
.accountId("string")
.bucketName("string")
.jurisdiction("string")
.rules(R2BucketLockRuleArgs.builder()
.condition(R2BucketLockRuleConditionArgs.builder()
.type("string")
.date("string")
.maxAgeSeconds(0)
.build())
.enabled(false)
.id("string")
.prefix("string")
.build())
.build());
r2bucket_lock_resource = cloudflare.R2BucketLock("r2bucketLockResource",
account_id="string",
bucket_name="string",
jurisdiction="string",
rules=[{
"condition": {
"type": "string",
"date": "string",
"max_age_seconds": 0,
},
"enabled": False,
"id": "string",
"prefix": "string",
}])
const r2bucketLockResource = new cloudflare.R2BucketLock("r2bucketLockResource", {
accountId: "string",
bucketName: "string",
jurisdiction: "string",
rules: [{
condition: {
type: "string",
date: "string",
maxAgeSeconds: 0,
},
enabled: false,
id: "string",
prefix: "string",
}],
});
type: cloudflare:R2BucketLock
properties:
accountId: string
bucketName: string
jurisdiction: string
rules:
- condition:
date: string
maxAgeSeconds: 0
type: string
enabled: false
id: string
prefix: string
R2BucketLock 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 R2BucketLock resource accepts the following input properties:
- Account
Id string - Account ID
- Bucket
Name string - Name of the bucket
- Jurisdiction string
- Jurisdiction of the bucket
- Rules
List<R2Bucket
Lock Rule>
- Account
Id string - Account ID
- Bucket
Name string - Name of the bucket
- Jurisdiction string
- Jurisdiction of the bucket
- Rules
[]R2Bucket
Lock Rule Args
- account
Id String - Account ID
- bucket
Name String - Name of the bucket
- jurisdiction String
- Jurisdiction of the bucket
- rules
List<R2Bucket
Lock Rule>
- account
Id string - Account ID
- bucket
Name string - Name of the bucket
- jurisdiction string
- Jurisdiction of the bucket
- rules
R2Bucket
Lock Rule[]
- account_
id str - Account ID
- bucket_
name str - Name of the bucket
- jurisdiction str
- Jurisdiction of the bucket
- rules
Sequence[R2Bucket
Lock Rule Args]
- account
Id String - Account ID
- bucket
Name 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 R2BucketLock 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 R2BucketLock Resource
Get an existing R2BucketLock 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?: R2BucketLockState, opts?: CustomResourceOptions): R2BucketLock
@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[R2BucketLockRuleArgs]] = None) -> R2BucketLock
func GetR2BucketLock(ctx *Context, name string, id IDInput, state *R2BucketLockState, opts ...ResourceOption) (*R2BucketLock, error)
public static R2BucketLock Get(string name, Input<string> id, R2BucketLockState? state, CustomResourceOptions? opts = null)
public static R2BucketLock get(String name, Output<String> id, R2BucketLockState state, CustomResourceOptions options)
resources: _: type: cloudflare:R2BucketLock 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.
- Account
Id string - Account ID
- Bucket
Name string - Name of the bucket
- Jurisdiction string
- Jurisdiction of the bucket
- Rules
List<R2Bucket
Lock Rule>
- Account
Id string - Account ID
- Bucket
Name string - Name of the bucket
- Jurisdiction string
- Jurisdiction of the bucket
- Rules
[]R2Bucket
Lock Rule Args
- account
Id String - Account ID
- bucket
Name String - Name of the bucket
- jurisdiction String
- Jurisdiction of the bucket
- rules
List<R2Bucket
Lock Rule>
- account
Id string - Account ID
- bucket
Name string - Name of the bucket
- jurisdiction string
- Jurisdiction of the bucket
- rules
R2Bucket
Lock Rule[]
- account_
id str - Account ID
- bucket_
name str - Name of the bucket
- jurisdiction str
- Jurisdiction of the bucket
- rules
Sequence[R2Bucket
Lock Rule Args]
- account
Id String - Account ID
- bucket
Name String - Name of the bucket
- jurisdiction String
- Jurisdiction of the bucket
- rules List<Property Map>
Supporting Types
R2BucketLockRule, R2BucketLockRuleArgs
- Condition
R2Bucket
Lock Rule Condition - Condition to apply a lock rule to an object for how long in seconds
- Enabled bool
- Whether or not this rule is in effect
- Id string
- Unique identifier for this rule
- Prefix string
- Rule 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
- Condition
R2Bucket
Lock Rule Condition - Condition to apply a lock rule to an object for how long in seconds
- Enabled bool
- Whether or not this rule is in effect
- Id string
- Unique identifier for this rule
- Prefix string
- Rule 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
- condition
R2Bucket
Lock Rule Condition - Condition to apply a lock rule to an object for how long in seconds
- enabled Boolean
- Whether or not this rule is in effect
- id String
- Unique identifier for this rule
- prefix String
- Rule 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
- condition
R2Bucket
Lock Rule Condition - Condition to apply a lock rule to an object for how long in seconds
- enabled boolean
- Whether or not this rule is in effect
- id string
- Unique identifier for this rule
- prefix string
- Rule 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
- condition
R2Bucket
Lock Rule Condition - Condition to apply a lock rule to an object for how long in seconds
- enabled bool
- Whether or not this rule is in effect
- id str
- Unique identifier for this rule
- prefix str
- Rule 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
- condition Property Map
- Condition to apply a lock rule to an object for how long in seconds
- enabled Boolean
- Whether or not this rule is in effect
- id String
- Unique identifier for this rule
- prefix String
- Rule 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
R2BucketLockRuleCondition, R2BucketLockRuleConditionArgs
- Type string
- Available values: "Age".
- Date string
- Max
Age intSeconds
- Type string
- Available values: "Age".
- Date string
- Max
Age intSeconds
- type String
- Available values: "Age".
- date String
- max
Age IntegerSeconds
- type string
- Available values: "Age".
- date string
- max
Age numberSeconds
- type str
- Available values: "Age".
- date str
- max_
age_ intseconds
- type String
- Available values: "Age".
- date String
- max
Age NumberSeconds
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflare
Terraform Provider.