Struct R2LocationHint
- Namespace
- Cloudflare.NET.Accounts.Models
- Assembly
- Cloudflare.NET.dll
Represents a location hint for R2 bucket placement.
Location hints provide a suggestion for the geographic region where the bucket's data should be stored. Cloudflare will attempt to honor this hint, but data may be placed in a nearby region if the specified location is unavailable.
[JsonConverter(typeof(ExtensibleEnumConverter<R2LocationHint>))]
public readonly struct R2LocationHint : IExtensibleEnum<R2LocationHint>, IEquatable<R2LocationHint>
- Implements
- Inherited Members
Examples
// Using a known location with IntelliSense
var location = R2LocationHint.EastNorthAmerica;
// Using implicit conversion from string
R2LocationHint customLocation = "new-region";
// Comparison
if (bucket.LocationHint == R2LocationHint.WestEurope) { ... }
Remarks
This is an extensible enum that provides IntelliSense for known values while allowing custom values for new regions that may be added to the Cloudflare API in the future.
Use the static properties for known regions (e.g., EastNorthAmerica) or create custom values using the constructor or implicit string conversion.
Constructors
R2LocationHint(string)
Creates a new R2LocationHint with the specified value.
public R2LocationHint(string value)
Parameters
valuestringThe string value representing the location hint.
Exceptions
- ArgumentNullException
Thrown when
valueis null.
Properties
AsiaPacific
Asia-Pacific region.
public static R2LocationHint AsiaPacific { get; }
Property Value
Remarks
Suitable for users primarily in Asian countries, including East Asia, Southeast Asia, and South Asia.
EastEurope
Eastern Europe region.
public static R2LocationHint EastEurope { get; }
Property Value
Remarks
Suitable for users primarily in Eastern European countries.
EastNorthAmerica
Eastern North America region.
public static R2LocationHint EastNorthAmerica { get; }
Property Value
Remarks
Suitable for users primarily in the eastern United States or eastern Canada.
Oceania
Oceania region.
public static R2LocationHint Oceania { get; }
Property Value
Remarks
Suitable for users primarily in Australia, New Zealand, and Pacific Island nations.
Value
Gets the underlying string value of this location hint.
public string Value { get; }
Property Value
WestEurope
Western Europe region.
public static R2LocationHint WestEurope { get; }
Property Value
Remarks
Suitable for users primarily in Western European countries.
WestNorthAmerica
Western North America region.
public static R2LocationHint WestNorthAmerica { get; }
Property Value
Remarks
Suitable for users primarily in the western United States, Canada, or Mexico.
Methods
Create(string)
Creates a new instance of the extensible enum from the specified string value.
public static R2LocationHint Create(string value)
Parameters
valuestringThe string value to wrap.
Returns
- R2LocationHint
A new instance of R2LocationHint containing the specified value.
Equals(R2LocationHint)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(R2LocationHint other)
Parameters
otherR2LocationHintAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(R2LocationHint, R2LocationHint)
Determines whether two R2LocationHint values are equal.
public static bool operator ==(R2LocationHint left, R2LocationHint right)
Parameters
leftR2LocationHintrightR2LocationHint
Returns
implicit operator string(R2LocationHint)
Implicitly converts an R2LocationHint to its string value.
public static implicit operator string(R2LocationHint location)
Parameters
locationR2LocationHintThe location hint to convert.
Returns
implicit operator R2LocationHint(string)
Implicitly converts a string to an R2LocationHint.
public static implicit operator R2LocationHint(string value)
Parameters
valuestringThe string value to convert.
Returns
operator !=(R2LocationHint, R2LocationHint)
Determines whether two R2LocationHint values are not equal.
public static bool operator !=(R2LocationHint left, R2LocationHint right)
Parameters
leftR2LocationHintrightR2LocationHint