using System.Runtime.Serialization;
using Newtonsoft.Json.Converters;
namespace AMWD.Net.Api.Cloudflare
{
///
/// A token.
/// Source
///
public class Token
{
///
/// Token identifier tag.
///
[JsonProperty("id")]
public string? Id { get; set; }
///
/// Token condition.
///
[JsonProperty("condition")]
public TokenCondition? Condition { get; set; }
///
/// The expiration time on or after which the JWT MUST NOT be accepted for processing.
///
[JsonProperty("created_on")]
public DateTime? ExpiresOn { get; set; }
///
/// The time on which the token was created.
///
public DateTime? IssuedOn { get; set; }
///
/// Last time the token was used.
///
public DateTime? LastUsedOn { get; set; }
///
/// Last time the token was modified.
///
public DateTime? ModifiedOn { get; set; }
///
/// Token name.
///
public string? Name { get; set; }
///
/// The time before which the token MUST NOT be accepted for processing.
///
public DateTime? NotBefore { get; set; }
///
/// List of access policies assigned to the token.
///
public IReadOnlyCollection? Policies { get; set; }
///
/// Status of the token.
///
public TokenStatus? Status { get; set; }
}
///
/// Token condition.
/// Source
///
public class TokenCondition
{
///
/// Client IP restrictions.
///
[JsonProperty("request_ip")]
public TokenConditionRequestIP? RequestIp { get; set; }
}
///
/// Client IP restrictions.
/// Source
///
public class TokenConditionRequestIP
{
///
/// List of IPv4/IPv6 CIDR addresses.
///
[JsonProperty("in")]
public IReadOnlyCollection? Allowed { get; set; }
///
/// List of IPv4/IPv6 CIDR addresses.
///
[JsonProperty("not_in")]
public IReadOnlyCollection? Denied { get; set; }
}
///
/// Status of the token.
/// Source
///
[JsonConverter(typeof(StringEnumConverter))]
public enum TokenStatus
{
///
/// The token is active.
///
[EnumMember(Value = "active")]
Active = 1,
///
/// The token is disabled.
///
[EnumMember(Value = "disabled")]
Disabled = 2,
///
/// The token is expired.
///
[EnumMember(Value = "expired")]
Expired = 3
}
}