## Put Bucket Lock Rules `client.r2.buckets.locks.update(stringbucketName, LockUpdateParamsparams, RequestOptionsoptions?): LockUpdateResponse` **put** `/accounts/{account_id}/r2/buckets/{bucket_name}/lock` Set lock rules for a bucket. ### Parameters - `bucketName: string` Name of the bucket. - `params: LockUpdateParams` - `account_id: string` Path param: Account ID. - `rules?: Array` Body param - `id: string` Unique identifier for this rule. - `condition: R2LockRuleAgeCondition | R2LockRuleDateCondition | R2LockRuleIndefiniteCondition` Condition to apply a lock rule to an object for how long in seconds. - `R2LockRuleAgeCondition` Condition to apply a lock rule to an object for how long in seconds. - `maxAgeSeconds: number` - `type: "Age"` - `"Age"` - `R2LockRuleDateCondition` Condition to apply a lock rule to an object until a specific date. - `date: string` - `type: "Date"` - `"Date"` - `R2LockRuleIndefiniteCondition` Condition to apply a lock rule indefinitely. - `type: "Indefinite"` - `"Indefinite"` - `enabled: boolean` Whether or not this rule is in effect. - `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. - `jurisdiction?: "default" | "eu" | "fedramp"` Header param: Jurisdiction where objects in this bucket are guaranteed to be stored. - `"default"` - `"eu"` - `"fedramp"` ### Returns - `LockUpdateResponse = unknown` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const lock = await client.r2.buckets.locks.update('example-bucket', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(lock); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ "string" ], "result": {}, "success": true } ```