Struct ZoneStatus
- Namespace
- Cloudflare.NET.Zones.Models
- Assembly
- Cloudflare.NET.dll
Represents the status of a Cloudflare Zone.
Zone statuses indicate the current state of a zone in Cloudflare's system, such as whether it's active, pending verification, or has been moved/deleted.
[JsonConverter(typeof(ExtensibleEnumConverter<ZoneStatus>))]
public readonly struct ZoneStatus : IExtensibleEnum<ZoneStatus>, IEquatable<ZoneStatus>
- Implements
- Inherited Members
Examples
// Using a known status with IntelliSense
var status = ZoneStatus.Active;
// Checking zone status
if (zone.Status == ZoneStatus.Active) { ... }
// Using implicit conversion from string
ZoneStatus customStatus = "new-status";
Remarks
This is an extensible enum that provides IntelliSense for known values while allowing custom values for new statuses that may be added to the Cloudflare API in the future.
Use the static properties for known statuses (e.g., Active, Pending) or create custom values using the constructor or implicit string conversion.
Constructors
ZoneStatus(string)
Creates a new ZoneStatus with the specified value.
public ZoneStatus(string value)
Parameters
valuestringThe string value representing the status.
Exceptions
- ArgumentNullException
Thrown when
valueis null.
Properties
Active
Active status - the zone is fully operational and serving traffic.
public static ZoneStatus Active { get; }
Property Value
Remarks
This is the normal status for a zone that has completed setup and is working correctly.
Deactivated
Deactivated status - the zone has been deactivated.
public static ZoneStatus Deactivated { get; }
Property Value
Remarks
This status indicates the zone is no longer active, possibly due to billing issues or manual deactivation.
Deleted
Deleted status - the zone has been removed.
public static ZoneStatus Deleted { get; }
Property Value
Remarks
This status indicates the zone has been deleted from Cloudflare.
Initializing
Initializing status - the zone is being set up.
public static ZoneStatus Initializing { get; }
Property Value
Remarks
This is a transitional status that occurs during zone creation.
Moved
Moved status - the zone has been transferred to another account.
public static ZoneStatus Moved { get; }
Property Value
Remarks
This status indicates the zone is no longer accessible in this account because it has been moved to a different Cloudflare account.
Pending
Pending status - the zone is awaiting nameserver verification.
public static ZoneStatus Pending { get; }
Property Value
Remarks
A zone enters this status when first added to Cloudflare. The domain's nameservers must be changed to Cloudflare's nameservers for verification to complete.
Value
Gets the underlying string value of this status.
public string Value { get; }
Property Value
Methods
Create(string)
Creates a new instance of the extensible enum from the specified string value.
public static ZoneStatus Create(string value)
Parameters
valuestringThe string value to wrap.
Returns
- ZoneStatus
A new instance of ZoneStatus containing the specified value.
Equals(ZoneStatus)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ZoneStatus other)
Parameters
otherZoneStatusAn 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 ==(ZoneStatus, ZoneStatus)
Determines whether two ZoneStatus values are equal.
public static bool operator ==(ZoneStatus left, ZoneStatus right)
Parameters
leftZoneStatusrightZoneStatus
Returns
implicit operator string(ZoneStatus)
Implicitly converts a ZoneStatus to its string value.
public static implicit operator string(ZoneStatus status)
Parameters
statusZoneStatusThe status to convert.
Returns
implicit operator ZoneStatus(string)
Implicitly converts a string to a ZoneStatus.
public static implicit operator ZoneStatus(string value)
Parameters
valuestringThe string value to convert.
Returns
operator !=(ZoneStatus, ZoneStatus)
Determines whether two ZoneStatus values are not equal.
public static bool operator !=(ZoneStatus left, ZoneStatus right)
Parameters
leftZoneStatusrightZoneStatus