Skip to content
Start here

Put Rules

client.cloudConnector.rules.update(RuleUpdateParams { zone_id, rules } params, RequestOptionsoptions?): SinglePage<RuleUpdateResponse { id, description, enabled, 3 more } >
PUT/zones/{zone_id}/cloud_connector/rules

Put Rules

Security

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Cloud Connector Write
ParametersExpand Collapse
params: RuleUpdateParams { zone_id, rules }
zone_id: string

Path param: Identifier.

maxLength32
rules?: Array<Rule>

Body param

id?: string
description?: string
enabled?: boolean
expression?: string
parameters?: Parameters { host }

Parameters of Cloud Connector Rule

host?: string

Host to perform Cloud Connection to

provider?: "aws_s3" | "cloudflare_r2" | "gcp_storage" | "azure_storage"

Cloud Provider type

One of the following:
"aws_s3"
"cloudflare_r2"
"gcp_storage"
"azure_storage"
ReturnsExpand Collapse
RuleUpdateResponse { id, description, enabled, 3 more }
id?: string
description?: string
enabled?: boolean
expression?: string
parameters?: Parameters { host }

Parameters of Cloud Connector Rule

host?: string

Host to perform Cloud Connection to

provider?: "aws_s3" | "cloudflare_r2" | "gcp_storage" | "azure_storage"

Cloud Provider type

One of the following:
"aws_s3"
"cloudflare_r2"
"gcp_storage"
"azure_storage"

Put Rules

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted
  apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const ruleUpdateResponse of client.cloudConnector.rules.update({
  zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
})) {
  console.log(ruleUpdateResponse.id);
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "id": "95c365e17e1b46599cd99e5b231fac4e",
      "description": "Rule description",
      "enabled": true,
      "expression": "http.cookie eq \"a=b\"",
      "parameters": {
        "host": "examplebucket.s3.eu-north-1.amazonaws.com"
      },
      "provider": "aws_s3"
    }
  ]
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "id": "95c365e17e1b46599cd99e5b231fac4e",
      "description": "Rule description",
      "enabled": true,
      "expression": "http.cookie eq \"a=b\"",
      "parameters": {
        "host": "examplebucket.s3.eu-north-1.amazonaws.com"
      },
      "provider": "aws_s3"
    }
  ]
}