using System.Runtime.Serialization;
using Newtonsoft.Json.Converters;
namespace AMWD.Net.Api.Cloudflare.Zones
{
///
/// A Cloudflare zone.
/// Source
///
public class Zone
{
///
/// Initializes a new instance of the class.
///
/// Identifier.
/// The domain name.
/// The name servers Cloudflare assigns to the zone.
/// The account the zone belongs to.
/// Metadata about the zone.
/// The owner of the zone.
public Zone(string id, string name, IReadOnlyCollection nameServers, ZoneAccount account, ZoneMeta meta, ZoneOwner owner)
{
Id = id;
Account = account;
Meta = meta;
Name = name;
NameServers = nameServers;
Owner = owner;
#pragma warning disable CS0612
Plan = new();
#pragma warning restore CS0612
}
///
/// Identifier.
///
[JsonProperty("id")]
public string Id { get; set; }
///
/// The account the zone belongs to.
///
[JsonProperty("account")]
public ZoneAccount Account { get; set; }
///
/// The last time proof of ownership was detected and the zone was made active.
///
[JsonProperty("activated_on")]
public DateTime? ActivatedOn { get; set; }
///
/// When the zone was created.
///
[JsonProperty("created_on")]
public DateTime CreatedOn { get; set; }
///
/// The interval (in seconds) from when development mode expires (positive integer)
/// or last expired (negative integer) for the domain. If development mode has never
/// been enabled, this value is 0.
///
[JsonProperty("development_mode")]
public int DevelopmentMode { get; set; }
///
/// Metadata about the zone.
///
[JsonProperty("meta")]
public ZoneMeta Meta { get; set; }
///
/// When the zone was last modified.
///
[JsonProperty("modified_on")]
public DateTime ModifiedOn { get; set; }
///
/// The domain name.
///
[JsonProperty("name")]
public string Name { get; set; }
///
/// The name servers Cloudflare assigns to a zone.
///
[JsonProperty("name_servers")]
public IReadOnlyCollection NameServers { get; set; }
///
/// DNS host at the time of switching to Cloudflare.
///
[JsonProperty("original_dnshost")]
public string? OriginalDnsHost { get; set; }
///
/// Original name servers before moving to Cloudflare.
///
[JsonProperty("original_name_servers")]
public IReadOnlyCollection? OriginalNameServers { get; set; }
///
/// Registrar for the domain at the time of switching to Cloudflare.
///
[JsonProperty("original_registrar")]
public string? OriginalRegistrar { get; set; }
///
/// The owner of the zone.
///
[JsonProperty("owner")]
public ZoneOwner Owner { get; set; }
///
/// A Zones subscription information.
///
[Obsolete]
[JsonProperty("plan")]
public ZonePlan Plan { get; set; }
///
/// Allows the customer to use a custom apex.
/// Tenants Only Configuration.
///
[JsonProperty("cname_suffix")]
public string? CnameSuffix { get; set; }
///
/// Indicates whether the zone is only using Cloudflare DNS services.
///
///
/// A value means the zone will not receive security or performance benefits.
///
[JsonProperty("paused")]
public bool? Paused { get; set; }
///
/// Legacy permissions based on legacy user membership information.
///
[Obsolete]
[JsonProperty("permissions")]
public IReadOnlyCollection? Permissions { get; set; }
///
/// The zone status on Cloudflare.
///
[JsonProperty("status")]
public ZoneStatus? Status { get; set; }
///
/// The root organizational unit that this zone belongs to (such as a tenant or organization).
///
[JsonProperty("tenant")]
public ZoneTenant? Tenant { get; set; }
///
/// The immediate parent organizational unit that this zone belongs to (such as under a tenant or sub-organization).
///
[JsonProperty("tenant_unit")]
public ZoneTenantUnit? TenantUnit { get; set; }
///
/// A full zone implies that DNS is hosted with Cloudflare.
/// A partial zone is typically a partner-hosted zone or a CNAME setup.
///
[JsonProperty("type")]
public ZoneType? Type { get; set; }
///
/// An array of domains used for custom name servers.
/// This is only available for Business and Enterprise plans.
///
[JsonProperty("vanity_name_servers")]
public IReadOnlyCollection? VanityNameServers { get; set; }
///
/// Verification key for partial zone setup.
///
[JsonProperty("verification_key")]
public string? VerificationKey { get; set; }
}
///
/// The account the zone belongs to.
/// Source
///
public class ZoneAccount
{
///
/// Identifier.
///
[JsonProperty("id")]
public string? Id { get; set; }
///
/// The name of the account.
///
[JsonProperty("name")]
public string? Name { get; set; }
}
///
/// Metadata about the zone.
/// Source
///
public class ZoneMeta
{
///
/// The zone is only configured for CDN.
///
[JsonProperty("cdn_only")]
public bool? CdnOnly { get; set; }
///
/// Number of Custom Certificates the zone can have.
///
[JsonProperty("custom_certificate_quota")]
public int? CustomCertificateQuota { get; set; }
///
/// The zone is only configured for DNS.
///
[JsonProperty("dns_only")]
public bool? DnsOnly { get; set; }
///
/// The zone is setup with Foundation DNS.
///
[JsonProperty("foundation_dns")]
public bool? FoundationDns { get; set; }
///
/// Number of Page Rules a zone can have.
///
[JsonProperty("page_rule_quota")]
public int? PageRuleQuota { get; set; }
///
/// The zone has been flagged for phishing.
///
[JsonProperty("phishing_detected")]
public bool? PhishingDetected { get; set; }
///
/// Step.
///
[JsonProperty("step")]
public int? Step { get; set; }
}
///
/// The owner of the zone.
/// Source
///
public class ZoneOwner
{
///
/// Identifier.
///
[JsonProperty("id")]
public string? Id { get; set; }
///
/// Name of the owner.
///
[JsonProperty("name")]
public string? Name { get; set; }
///
/// The type of owner.
///
[JsonProperty("type")]
public string? Type { get; set; }
}
///
/// A Zones subscription information.
/// Source
///
[Obsolete]
public class ZonePlan
{
///
/// Identifier.
///
[JsonProperty("id")]
public string? Id { get; set; }
///
/// States if the subscription can be activated.
///
[JsonProperty("can_subscribe")]
public bool? CanSubscribe { get; set; }
///
/// The denomination of the customer.
///
[JsonProperty("currency")]
public string? Currency { get; set; }
///
/// If this Zone is managed by another company.
///
[JsonProperty("externally_managed")]
public bool? ExternallyManaged { get; set; }
///
/// How often the customer is billed.
///
[JsonProperty("frequency")]
public RenewFrequency? Frequency { get; set; }
///
/// States if the subscription active.
///
[JsonProperty("is_subscribed")]
public bool? IsSubscribed { get; set; }
///
/// If the legacy discount applies to this Zone.
///
[JsonProperty("legacy_discount")]
public bool? LegacyDiscount { get; set; }
///
/// The legacy name of the plan.
///
[JsonProperty("legacy_id")]
public string? LegacyId { get; set; }
///
/// Name of the owner.
///
[JsonProperty("name")]
public string? Name { get; set; }
///
/// How much the customer is paying.
///
[JsonProperty("price")]
public decimal? Price { get; set; }
}
///
/// Zone status.
/// Source
///
[JsonConverter(typeof(StringEnumConverter))]
public enum ZoneStatus
{
///
/// Initializing.
///
[EnumMember(Value = "initializing")]
Initializing = 1,
///
/// Pending.
///
[EnumMember(Value = "pending")]
Pending = 2,
///
/// Active.
///
[EnumMember(Value = "active")]
Active = 3,
///
/// Moved.
///
[EnumMember(Value = "moved")]
Moved = 4
}
///
/// The root organizational unit that this zone belongs to (such as a tenant or organization).
/// Source
///
public class ZoneTenant
{
///
/// Identifier.
///
[JsonProperty("id")]
public string? Id { get; set; }
///
/// The name of the Tenant account.
///
[JsonProperty("name")]
public string? Name { get; set; }
}
///
/// The immediate parent organizational unit that this zone belongs to (such as under a tenant or sub-organization).
/// Source
///
public class ZoneTenantUnit
{
///
/// Identifier.
///
[JsonProperty("id")]
public string? Id { get; set; }
}
}