Table of Contents

Struct R2Jurisdiction

Namespace
Cloudflare.NET.Accounts.Models
Assembly
Cloudflare.NET.dll

Represents a jurisdictional restriction for R2 bucket data storage.

Jurisdictions provide a guarantee that objects stored in the bucket will remain within a specific geographic or regulatory boundary. Unlike location hints, jurisdictions are enforced constraints.

[JsonConverter(typeof(ExtensibleEnumConverter<R2Jurisdiction>))]
public readonly struct R2Jurisdiction : IExtensibleEnum<R2Jurisdiction>, IEquatable<R2Jurisdiction>
Implements
Inherited Members

Examples

// Create an EU jurisdiction bucket
var bucket = await api.Buckets.CreateAsync("my-bucket", jurisdiction: R2Jurisdiction.EuropeanUnion);

// IMPORTANT: Pass the same jurisdiction for all subsequent operations
var details = await api.Buckets.GetAsync("my-bucket", R2Jurisdiction.EuropeanUnion);
await api.Buckets.SetCorsAsync("my-bucket", corsPolicy, R2Jurisdiction.EuropeanUnion);
await api.Buckets.DeleteAsync("my-bucket", R2Jurisdiction.EuropeanUnion);

Remarks

This is an extensible enum that provides IntelliSense for known values while allowing custom values for new jurisdictions that may be added to the Cloudflare API in the future.

Important: When to Pass Jurisdiction to API Methods

If you create a bucket with a jurisdiction (e.g., EuropeanUnion or FedRamp), you must pass the same jurisdiction value to all subsequent API operations on that bucket. Without it, the API returns error 10006 "The specified bucket does not exist" even though the bucket exists.

The jurisdiction is required for: GetAsync, DeleteAsync, all CORS operations, all lifecycle operations, all custom domain operations, all managed domain operations, all lock operations, and all Sippy operations.

The jurisdiction is not required for: ListAsync / ListAllAsync (returns all buckets with their jurisdiction in the response) and CreateTempCredentialsAsync (bucket is in the request body).

Best Practice: Store the jurisdiction value when creating a bucket and reuse it for all subsequent operations on that bucket.

When accessing jurisdictional buckets via the S3 API, you must specify the jurisdiction in the endpoint: https://{account_id}.{jurisdiction}.r2.cloudflarestorage.com

The FedRamp jurisdiction requires Enterprise customer status. Contact your Cloudflare account team for access.

Constructors

R2Jurisdiction(string)

Creates a new R2Jurisdiction with the specified value.

public R2Jurisdiction(string value)

Parameters

value string

The string value representing the jurisdiction.

Exceptions

ArgumentNullException

Thrown when value is null.

Properties

Default

No jurisdictional restriction.

public static R2Jurisdiction Default { get; }

Property Value

R2Jurisdiction

Remarks

Data may be stored in any Cloudflare data center globally. This is the default when no jurisdiction is specified.

EuropeanUnion

European Union jurisdiction.

public static R2Jurisdiction EuropeanUnion { get; }

Property Value

R2Jurisdiction

Remarks

Objects are guaranteed to be stored within the European Union, helping meet GDPR and other EU data residency requirements.

When using the S3 API, use the endpoint: https://{account_id}.eu.r2.cloudflarestorage.com

FedRamp

FedRAMP jurisdiction.

public static R2Jurisdiction FedRamp { get; }

Property Value

R2Jurisdiction

Remarks

Objects are stored in compliance with FedRAMP (Federal Risk and Authorization Management Program) requirements for U.S. federal government data.

This jurisdiction requires Enterprise customer status. Contact your Cloudflare account team or Cloudflare Support for access.

When using the S3 API, use the endpoint: https://{account_id}.fedramp.r2.cloudflarestorage.com

UnitedStates

United States jurisdiction.

public static R2Jurisdiction UnitedStates { get; }

Property Value

R2Jurisdiction

Remarks

Objects are guaranteed to be stored and processed within the United States, helping meet US data residency requirements.

When using the S3 API, use the endpoint: https://{account_id}.us.r2.cloudflarestorage.com

Value

Gets the underlying string value of this jurisdiction.

public string Value { get; }

Property Value

string

Methods

Create(string)

Creates a new instance of the extensible enum from the specified string value.

public static R2Jurisdiction Create(string value)

Parameters

value string

The string value to wrap.

Returns

R2Jurisdiction

A new instance of R2Jurisdiction containing the specified value.

Equals(R2Jurisdiction)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(R2Jurisdiction other)

Parameters

other R2Jurisdiction

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

GetS3EndpointUrl(string)

Gets the S3-compatible endpoint URL for this jurisdiction.

public string GetS3EndpointUrl(string accountId)

Parameters

accountId string

The Cloudflare account ID.

Returns

string

The full S3 endpoint URL for this jurisdiction.

Examples

var endpoint = R2Jurisdiction.EuropeanUnion.GetS3EndpointUrl("abc123");
// Returns: "https://abc123.eu.r2.cloudflarestorage.com"

var defaultEndpoint = R2Jurisdiction.Default.GetS3EndpointUrl("abc123");
// Returns: "https://abc123.r2.cloudflarestorage.com"

Exceptions

ArgumentException

Thrown when accountId is null or whitespace.

GetS3Subdomain()

Gets the S3 endpoint subdomain for this jurisdiction, or null for the default jurisdiction.

public string? GetS3Subdomain()

Returns

string

The subdomain string (e.g., "eu", "fedramp") for jurisdictional endpoints, or null for the default (global) jurisdiction.

Examples

R2Jurisdiction.EuropeanUnion.GetS3Subdomain(); // Returns: "eu"
R2Jurisdiction.FedRamp.GetS3Subdomain();       // Returns: "fedramp"
R2Jurisdiction.UnitedStates.GetS3Subdomain();  // Returns: "us"
R2Jurisdiction.Default.GetS3Subdomain();       // Returns: null

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(R2Jurisdiction, R2Jurisdiction)

Determines whether two R2Jurisdiction values are equal.

public static bool operator ==(R2Jurisdiction left, R2Jurisdiction right)

Parameters

left R2Jurisdiction
right R2Jurisdiction

Returns

bool

implicit operator string(R2Jurisdiction)

Implicitly converts an R2Jurisdiction to its string value.

public static implicit operator string(R2Jurisdiction jurisdiction)

Parameters

jurisdiction R2Jurisdiction

The jurisdiction to convert.

Returns

string

implicit operator R2Jurisdiction(string)

Implicitly converts a string to an R2Jurisdiction.

public static implicit operator R2Jurisdiction(string value)

Parameters

value string

The string value to convert.

Returns

R2Jurisdiction

operator !=(R2Jurisdiction, R2Jurisdiction)

Determines whether two R2Jurisdiction values are not equal.

public static bool operator !=(R2Jurisdiction left, R2Jurisdiction right)

Parameters

left R2Jurisdiction
right R2Jurisdiction

Returns

bool

See Also