Moving folder structure
This commit is contained in:
36
src/Cloudflare/Auth/ApiKeyAuthentication.cs
Normal file
36
src/Cloudflare/Auth/ApiKeyAuthentication.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Net.Http;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the interface to authenticate using an API key and email address.
|
||||
/// </summary>
|
||||
public class ApiKeyAuthentication : IAuthentication
|
||||
{
|
||||
private readonly string _emailAddress;
|
||||
private readonly string _apiKey;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiKeyAuthentication"/> class.
|
||||
/// </summary>
|
||||
/// <param name="emailAddress">The email address.</param>
|
||||
/// <param name="apiKey">The global API key.</param>
|
||||
public ApiKeyAuthentication(string emailAddress, string apiKey)
|
||||
{
|
||||
emailAddress.ValidateCloudflareEmailAddress();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(apiKey))
|
||||
throw new ArgumentNullException(nameof(apiKey));
|
||||
|
||||
_emailAddress = emailAddress;
|
||||
_apiKey = apiKey;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void AddHeader(HttpClient httpClient)
|
||||
{
|
||||
httpClient.DefaultRequestHeaders.Add("X-Auth-Email", _emailAddress);
|
||||
httpClient.DefaultRequestHeaders.Add("X-Auth-Key", _apiKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
31
src/Cloudflare/Auth/ApiTokenAuthentication.cs
Normal file
31
src/Cloudflare/Auth/ApiTokenAuthentication.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the interface to authenticate using an API token.
|
||||
/// </summary>
|
||||
public class ApiTokenAuthentication : IAuthentication
|
||||
{
|
||||
private readonly string _apiToken;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiTokenAuthentication"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiToken">The API token.</param>
|
||||
public ApiTokenAuthentication(string apiToken)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(apiToken))
|
||||
throw new ArgumentNullException(nameof(apiToken));
|
||||
|
||||
_apiToken = apiToken;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void AddHeader(HttpClient httpClient)
|
||||
{
|
||||
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _apiToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
53
src/Cloudflare/ClientOptions.cs
Normal file
53
src/Cloudflare/ClientOptions.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Net;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Options for the Cloudflare API.
|
||||
/// </summary>
|
||||
public class ClientOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the default base url for the API.
|
||||
/// </summary>
|
||||
public virtual string BaseUrl { get; set; } = "https://api.cloudflare.com/client/v4/";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default timeout for the API.
|
||||
/// </summary>
|
||||
public virtual TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(100);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum number of retries for the API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The API may respond with an 5xx error and a X-Should-Retry header indicating that the request should be retried.
|
||||
/// </remarks>
|
||||
public virtual int MaxRetries { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets additional default headers to every request.
|
||||
/// </summary>
|
||||
public virtual IDictionary<string, string> DefaultHeaders { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets additional default query parameters to every request.
|
||||
/// </summary>
|
||||
public virtual IDictionary<string, string> DefaultQueryParams { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to allow redirects.
|
||||
/// </summary>
|
||||
public virtual bool AllowRedirects { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to use a proxy.
|
||||
/// </summary>
|
||||
public virtual bool UseProxy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the proxy information.
|
||||
/// </summary>
|
||||
public virtual IWebProxy? Proxy { get; set; }
|
||||
}
|
||||
}
|
||||
22
src/Cloudflare/Cloudflare.csproj
Normal file
22
src/Cloudflare/Cloudflare.csproj
Normal file
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
|
||||
<NrtTagMatch>v[0-9]*</NrtTagMatch>
|
||||
|
||||
<PackageId>AMWD.Net.API.Cloudflare</PackageId>
|
||||
<PackageTags>cloudflare api</PackageTags>
|
||||
|
||||
<AssemblyName>amwd-cloudflare-core</AssemblyName>
|
||||
<RootNamespace>AMWD.Net.Api.Cloudflare</RootNamespace>
|
||||
|
||||
<Product>Cloudflare API - Core</Product>
|
||||
<Description>Core features of the Cloudflare API</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Only build package for tagged releases or Debug on CI (only dev NuGet feed) -->
|
||||
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(CI_COMMIT_TAG)', '^v[0-9.]+')) or ('$(Configuration)' == 'Debug' and '$(GITLAB_CI)' == 'true')">
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
301
src/Cloudflare/CloudflareClient.cs
Normal file
301
src/Cloudflare/CloudflareClient.cs
Normal file
@@ -0,0 +1,301 @@
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Reflection;
|
||||
using System.Security.Authentication;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the Core of the Cloudflare API client.
|
||||
/// </summary>
|
||||
public class CloudflareClient : ICloudflareClient, IDisposable
|
||||
{
|
||||
private static readonly JsonSerializerSettings _jsonSerializerSettings = new()
|
||||
{
|
||||
Culture = CultureInfo.InvariantCulture,
|
||||
Formatting = Formatting.None,
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
};
|
||||
|
||||
private readonly ClientOptions _clientOptions;
|
||||
private readonly HttpClient _httpClient;
|
||||
|
||||
private bool _isDisposed = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CloudflareClient"/> class.
|
||||
/// </summary>
|
||||
/// <param name="emailAddress">The email address of the Cloudflare account.</param>
|
||||
/// <param name="apiKey">The API key of the Cloudflare account.</param>
|
||||
/// <param name="clientOptions">The client options (optional).</param>
|
||||
public CloudflareClient(string emailAddress, string apiKey, ClientOptions? clientOptions = null)
|
||||
: this(new ApiKeyAuthentication(emailAddress, apiKey), clientOptions)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CloudflareClient"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiToken">The API token.</param>
|
||||
/// <param name="clientOptions">The client options (optional).</param>
|
||||
public CloudflareClient(string apiToken, ClientOptions? clientOptions = null)
|
||||
: this(new ApiTokenAuthentication(apiToken), clientOptions)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CloudflareClient"/> class.
|
||||
/// </summary>
|
||||
/// <param name="authentication">The authentication information.</param>
|
||||
/// <param name="clientOptions">The client options (optional).</param>
|
||||
public CloudflareClient(IAuthentication authentication, ClientOptions? clientOptions = null)
|
||||
{
|
||||
if (authentication == null)
|
||||
throw new ArgumentNullException(nameof(authentication));
|
||||
|
||||
_clientOptions = clientOptions ?? new ClientOptions();
|
||||
ValidateClientOptions();
|
||||
|
||||
_httpClient = CreateHttpClient();
|
||||
authentication.AddHeader(_httpClient);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes of the resources used by the <see cref="CloudflareClient"/> object.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (_isDisposed)
|
||||
return;
|
||||
|
||||
_isDisposed = true;
|
||||
|
||||
_httpClient.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<CloudflareResponse<TResponse>> GetAsync<TResponse>(string requestPath, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
ValidateRequestPath(requestPath);
|
||||
|
||||
string requestUrl = BuildRequestUrl(requestPath, queryFilter);
|
||||
|
||||
var response = await _httpClient.GetAsync(requestUrl, cancellationToken).ConfigureAwait(false);
|
||||
return await GetCloudflareResponse<TResponse>(response, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<CloudflareResponse<TResponse>> PostAsync<TResponse, TRequest>(string requestPath, TRequest? request, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
ValidateRequestPath(requestPath);
|
||||
|
||||
string requestUrl = BuildRequestUrl(requestPath, queryFilter);
|
||||
var httpContent = ConvertRequest(request);
|
||||
|
||||
var response = await _httpClient.PostAsync(requestUrl, httpContent, cancellationToken).ConfigureAwait(false);
|
||||
return await GetCloudflareResponse<TResponse>(response, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<CloudflareResponse<TResponse>> PutAsync<TResponse, TRequest>(string requestPath, TRequest? request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
ValidateRequestPath(requestPath);
|
||||
|
||||
string requestUrl = BuildRequestUrl(requestPath);
|
||||
var httpContent = ConvertRequest(request);
|
||||
|
||||
var response = await _httpClient.PutAsync(requestUrl, httpContent, cancellationToken).ConfigureAwait(false);
|
||||
return await GetCloudflareResponse<TResponse>(response, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<CloudflareResponse<TResponse>> DeleteAsync<TResponse>(string requestPath, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
ValidateRequestPath(requestPath);
|
||||
|
||||
string requestUrl = BuildRequestUrl(requestPath, queryFilter);
|
||||
|
||||
var response = await _httpClient.DeleteAsync(requestUrl, cancellationToken).ConfigureAwait(false);
|
||||
return await GetCloudflareResponse<TResponse>(response, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<CloudflareResponse<TResponse>> PatchAsync<TResponse, TRequest>(string requestPath, TRequest? request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
ValidateRequestPath(requestPath);
|
||||
|
||||
string requestUrl = BuildRequestUrl(requestPath);
|
||||
var httpContent = ConvertRequest(request);
|
||||
|
||||
var response = await _httpClient.PatchAsync(requestUrl, httpContent, cancellationToken).ConfigureAwait(false);
|
||||
return await GetCloudflareResponse<TResponse>(response, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private void ThrowIfDisposed()
|
||||
{
|
||||
if (_isDisposed)
|
||||
throw new ObjectDisposedException(GetType().FullName);
|
||||
}
|
||||
|
||||
private void ValidateClientOptions()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_clientOptions.BaseUrl))
|
||||
throw new ArgumentNullException(nameof(_clientOptions.BaseUrl));
|
||||
|
||||
if (_clientOptions.Timeout <= TimeSpan.Zero)
|
||||
throw new ArgumentOutOfRangeException(nameof(_clientOptions.Timeout), "Timeout must be positive.");
|
||||
|
||||
if (_clientOptions.MaxRetries < 0 || 10 < _clientOptions.MaxRetries)
|
||||
throw new ArgumentOutOfRangeException(nameof(_clientOptions.MaxRetries), "MaxRetries should be between 0 and 10.");
|
||||
|
||||
if (_clientOptions.UseProxy && _clientOptions.Proxy == null)
|
||||
throw new ArgumentNullException(nameof(_clientOptions.Proxy));
|
||||
}
|
||||
|
||||
private void ValidateRequestPath(string requestPath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(requestPath))
|
||||
throw new ArgumentNullException(nameof(requestPath));
|
||||
|
||||
if (requestPath.Contains("?"))
|
||||
throw new ArgumentException("Query parameters are not allowed", nameof(requestPath));
|
||||
}
|
||||
|
||||
private HttpClient CreateHttpClient()
|
||||
{
|
||||
string version = typeof(CloudflareClient).Assembly
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
|
||||
?.InformationalVersion ?? "unknown";
|
||||
|
||||
HttpMessageHandler handler;
|
||||
try
|
||||
{
|
||||
handler = new HttpClientHandler
|
||||
{
|
||||
AllowAutoRedirect = _clientOptions.AllowRedirects,
|
||||
UseProxy = _clientOptions.UseProxy,
|
||||
Proxy = _clientOptions.Proxy,
|
||||
};
|
||||
}
|
||||
catch (PlatformNotSupportedException)
|
||||
{
|
||||
handler = new HttpClientHandler
|
||||
{
|
||||
AllowAutoRedirect = _clientOptions.AllowRedirects,
|
||||
};
|
||||
}
|
||||
|
||||
// Ensure a clean base URL
|
||||
string baseUrl = _clientOptions.BaseUrl.Trim().TrimEnd('/');
|
||||
|
||||
var client = new HttpClient(handler, true)
|
||||
{
|
||||
BaseAddress = new Uri(baseUrl + '/'),
|
||||
Timeout = _clientOptions.Timeout,
|
||||
};
|
||||
|
||||
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("AMWD.CloudflareClient", version));
|
||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
|
||||
if (_clientOptions.DefaultHeaders.Count > 0)
|
||||
{
|
||||
foreach (var headerKvp in _clientOptions.DefaultHeaders)
|
||||
client.DefaultRequestHeaders.Add(headerKvp.Key, headerKvp.Value);
|
||||
}
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
private static async Task<CloudflareResponse<TRes>> GetCloudflareResponse<TRes>(HttpResponseMessage httpResponse, CancellationToken cancellationToken)
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
string content = await httpResponse.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
||||
#else
|
||||
string content = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
#endif
|
||||
switch (httpResponse.StatusCode)
|
||||
{
|
||||
case HttpStatusCode.Forbidden:
|
||||
case HttpStatusCode.Unauthorized:
|
||||
var errorResponse = JsonConvert.DeserializeObject<CloudflareResponse<object>>(content, _jsonSerializerSettings)
|
||||
?? throw new CloudflareException("Response is not a valid Cloudflare API response.");
|
||||
|
||||
string[] errors = errorResponse.Errors?.Select(e => $"{e.Code}: {e.Message}").ToArray() ?? [];
|
||||
throw new AuthenticationException(string.Join(Environment.NewLine, errors));
|
||||
|
||||
default:
|
||||
try
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<CloudflareResponse<TRes>>(content)
|
||||
?? throw new CloudflareException("Response is not a valid Cloudflare API response.");
|
||||
|
||||
return response;
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (typeof(TRes) == typeof(string))
|
||||
{
|
||||
object cObj = content.Replace("\\n", Environment.NewLine);
|
||||
return new CloudflareResponse<TRes>
|
||||
{
|
||||
Success = true,
|
||||
Result = (TRes)cObj,
|
||||
};
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string BuildRequestUrl(string requestPath, IQueryParameterFilter? queryFilter = null)
|
||||
{
|
||||
// Ensure a clean request path
|
||||
string reqPath = requestPath.Trim().TrimStart('/');
|
||||
var dict = new Dictionary<string, string>();
|
||||
|
||||
if (_clientOptions.DefaultQueryParams.Count > 0)
|
||||
{
|
||||
foreach (var paramKvp in _clientOptions.DefaultQueryParams)
|
||||
dict[paramKvp.Key] = paramKvp.Value;
|
||||
}
|
||||
|
||||
var queryParams = queryFilter?.GetQueryParameters();
|
||||
if (queryParams?.Count > 0)
|
||||
{
|
||||
foreach (var kvp in queryParams)
|
||||
dict[kvp.Key] = kvp.Value;
|
||||
}
|
||||
|
||||
if (dict.Count == 0)
|
||||
return reqPath;
|
||||
|
||||
string[] param = dict.Select(kvp => $"{kvp.Key}={WebUtility.UrlEncode(kvp.Value)}").ToArray();
|
||||
string query = string.Join("&", param);
|
||||
|
||||
return $"{reqPath}?{query}";
|
||||
}
|
||||
|
||||
private static HttpContent? ConvertRequest<T>(T request)
|
||||
{
|
||||
if (request == null)
|
||||
return null;
|
||||
|
||||
if (request is HttpContent httpContent)
|
||||
return httpContent;
|
||||
|
||||
string json = JsonConvert.SerializeObject(request, _jsonSerializerSettings);
|
||||
return new StringContent(json, Encoding.UTF8, "application/json");
|
||||
}
|
||||
}
|
||||
}
|
||||
37
src/Cloudflare/Enums/CertificateCA.cs
Normal file
37
src/Cloudflare/Enums/CertificateCA.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// The Certificate Authority that will issue the certificate.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L110">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum CertificateCA
|
||||
{
|
||||
/// <summary>
|
||||
/// DigiCert.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "digicert")]
|
||||
DigiCert = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Google.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "google")]
|
||||
Google = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Let's Encrypt.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "lets_encrypt")]
|
||||
LetsEncrypt = 3,
|
||||
|
||||
/// <summary>
|
||||
/// SSL.com.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ssl_com")]
|
||||
SslCom = 4
|
||||
}
|
||||
}
|
||||
37
src/Cloudflare/Enums/RenewFrequency.cs
Normal file
37
src/Cloudflare/Enums/RenewFrequency.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A frequency at which to renew subscriptions, etc.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L730">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum RenewFrequency
|
||||
{
|
||||
/// <summary>
|
||||
/// Weekly
|
||||
/// </summary>
|
||||
[EnumMember(Value = "weekly")]
|
||||
Weekly = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Monthly
|
||||
/// </summary>
|
||||
[EnumMember(Value = "monthly")]
|
||||
Monthly = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Quarterly
|
||||
/// </summary>
|
||||
[EnumMember(Value = "quarterly")]
|
||||
Quarterly = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Yearly
|
||||
/// </summary>
|
||||
[EnumMember(Value = "yearly")]
|
||||
Yearly = 4
|
||||
}
|
||||
}
|
||||
25
src/Cloudflare/Enums/SortDirection.cs
Normal file
25
src/Cloudflare/Enums/SortDirection.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// The direction to sort the entity.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L698">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum SortDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Sort in ascending order.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "asc")]
|
||||
Ascending = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Sort in descending order.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "desc")]
|
||||
Descending = 2
|
||||
}
|
||||
}
|
||||
60
src/Cloudflare/Exceptions/CloudflareException.cs
Normal file
60
src/Cloudflare/Exceptions/CloudflareException.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents errors that occur during Cloudflare API calls.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public class CloudflareException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CloudflareException"/> class.
|
||||
/// </summary>
|
||||
public CloudflareException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CloudflareException"/> class with a specified error
|
||||
/// message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message that describes the error.</param>
|
||||
public CloudflareException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CloudflareException"/> class with a specified error
|
||||
/// message and a reference to the inner exception that is the cause of this exception.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message that explains the reason for the exception.</param>
|
||||
/// <param name="innerException">
|
||||
/// The exception that is the cause of the current exception, or a <see langword="null"/> reference
|
||||
/// if no inner exception is specified.
|
||||
/// </param>
|
||||
public CloudflareException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CloudflareException"/> class with serialized data.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The <see cref="SerializationInfo"/> that holds the serialized
|
||||
/// object data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The <see cref="StreamingContext"/> that contains contextual information
|
||||
/// about the source or destination.
|
||||
/// </param>
|
||||
/// <exception cref="ArgumentNullException">The info parameter is null.</exception>
|
||||
/// <exception cref="SerializationException">The class name is <see langword="null"/> or <see cref="Exception.HResult"/> is zero (0).</exception>
|
||||
protected CloudflareException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
32
src/Cloudflare/Extensions/EnumExtensions.cs
Normal file
32
src/Cloudflare/Extensions/EnumExtensions.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="Enum"/>s.
|
||||
/// </summary>
|
||||
public static class EnumExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="EnumMemberAttribute.Value"/> of the <see cref="Enum"/> when available, otherwise the <see cref="Enum.ToString()"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The enum value.</param>
|
||||
public static string? GetEnumMemberValue(this Enum value)
|
||||
{
|
||||
var fieldInfo = value.GetType().GetField(value.ToString());
|
||||
if (fieldInfo == null)
|
||||
return value.ToString();
|
||||
|
||||
var enumMember = fieldInfo
|
||||
.GetCustomAttributes(typeof(EnumMemberAttribute), inherit: false)
|
||||
.Cast<EnumMemberAttribute>()
|
||||
.FirstOrDefault();
|
||||
|
||||
if (enumMember == null)
|
||||
return value.ToString();
|
||||
|
||||
return enumMember.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
53
src/Cloudflare/Extensions/HttpClientExtensions.cs
Normal file
53
src/Cloudflare/Extensions/HttpClientExtensions.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
#if ! NET6_0_OR_GREATER
|
||||
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Net.Http
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="HttpClient"/>s.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Copied from <see href="https://github.com/dotnet/runtime/blob/v6.0.0/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs">.NET 6 runtime / HttpClient</see>.
|
||||
/// </remarks>
|
||||
[Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
internal static class HttpClientExtensions
|
||||
{
|
||||
private static readonly HttpMethod _httpMethodPatch = new("PATCH");
|
||||
|
||||
/// <summary>
|
||||
/// Sends a PATCH request with a cancellation token to a Uri represented as a string as an asynchronous operation.
|
||||
/// </summary>
|
||||
/// <param name="client">A <see cref="HttpClient"/> instance.</param>
|
||||
/// <param name="requestUri">The Uri the request is sent to.</param>
|
||||
/// <param name="content">The HTTP request content sent to the server.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||||
/// <returns>The task object representing the asynchronous operation.</returns>
|
||||
public static Task<HttpResponseMessage> PatchAsync(this HttpClient client, string? requestUri, HttpContent? content, CancellationToken cancellationToken) =>
|
||||
client.PatchAsync(CreateUri(requestUri), content, cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Sends a PATCH request with a cancellation token as an asynchronous operation.
|
||||
/// </summary>
|
||||
/// <param name="client">A <see cref="HttpClient"/> instance.</param>
|
||||
/// <param name="requestUri">The Uri the request is sent to.</param>
|
||||
/// <param name="content">The HTTP request content sent to the server.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||||
/// <returns>The task object representing the asynchrnous operation.</returns>
|
||||
public static Task<HttpResponseMessage> PatchAsync(this HttpClient client, Uri? requestUri, HttpContent? content, CancellationToken cancellationToken)
|
||||
{
|
||||
var request = new HttpRequestMessage(_httpMethodPatch, requestUri)
|
||||
{
|
||||
Version = HttpVersion.Version11,
|
||||
Content = content,
|
||||
};
|
||||
return client.SendAsync(request, cancellationToken);
|
||||
}
|
||||
|
||||
private static Uri? CreateUri(string? uri) =>
|
||||
string.IsNullOrEmpty(uri) ? null : new Uri(uri, UriKind.RelativeOrAbsolute);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
78
src/Cloudflare/Extensions/StringExtensions.cs
Normal file
78
src/Cloudflare/Extensions/StringExtensions.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="string"/>s.
|
||||
/// </summary>
|
||||
public static class StringExtensions
|
||||
{
|
||||
private static readonly Regex _idCheckRegex = new(@"^[0-9a-f]{32}$", RegexOptions.Compiled);
|
||||
private static readonly Regex _emailCheckRegex = new(@"^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$", RegexOptions.Compiled);
|
||||
|
||||
/// <summary>
|
||||
/// Validate basic information for a Cloudflare ID.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// An Cloudflare ID has max. 32 characters.
|
||||
/// </remarks>
|
||||
/// <param name="id">The string to check.</param>
|
||||
/// <exception cref="ArgumentNullException">The <paramref name="id"/> is <see langword="null"/> or any kind of whitespace.</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">The <paramref name="id"/> has more than 32 characters.</exception>
|
||||
public static void ValidateCloudflareId(this string id)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
|
||||
id.ValidateLength(32, nameof(id));
|
||||
|
||||
if (!_idCheckRegex.IsMatch(id))
|
||||
throw new ArgumentException("Invalid Cloudflare ID", nameof(id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate basic information for a Cloudflare name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// An Cloudflare name has max. 253 characters.
|
||||
/// </remarks>
|
||||
/// <param name="name">The string to check.</param>
|
||||
/// <exception cref="ArgumentNullException">The <paramref name="name"/> is <see langword="null"/> or any kind of whitespace.</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">The <paramref name="name"/> has more than 253 characters.</exception>
|
||||
public static void ValidateCloudflareName(this string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
|
||||
name.ValidateLength(253, nameof(name));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate basic information for an email address.
|
||||
/// </summary>
|
||||
/// <param name="emailAddress">The string to check.</param>
|
||||
/// <exception cref="ArgumentNullException">The <paramref name="emailAddress"/> is <see langword="null"/> or any kind of whitespace.</exception>
|
||||
/// <exception cref="ArgumentException">The <paramref name="emailAddress"/> does not match the regular expression pattern for an email address.</exception>
|
||||
public static void ValidateCloudflareEmailAddress(this string emailAddress)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(emailAddress))
|
||||
throw new ArgumentNullException(nameof(emailAddress));
|
||||
|
||||
if (!_emailCheckRegex.IsMatch(emailAddress))
|
||||
throw new ArgumentException("Invalid email address", nameof(emailAddress));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate the length of a string.
|
||||
/// </summary>
|
||||
/// <param name="str">The string to check.</param>
|
||||
/// <param name="length">The max. length.</param>
|
||||
/// <param name="paramName">The name of the parameter to check.</param>
|
||||
/// <exception cref="ArgumentException">The <paramref name="str"/> is longer than <paramref name="length"/>.</exception>
|
||||
public static void ValidateLength(this string str, int length, string paramName)
|
||||
{
|
||||
if (str?.Length > length)
|
||||
throw new ArgumentException($"The value of '{paramName}' is too long. Only {length} characters are allowed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/Cloudflare/Interfaces/IAuthentication.cs
Normal file
16
src/Cloudflare/Interfaces/IAuthentication.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Net.Http;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the interface to add authentication information.
|
||||
/// </summary>
|
||||
public interface IAuthentication
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds authentication headers to the given <see cref="HttpClient"/>.
|
||||
/// </summary>
|
||||
/// <param name="httpClient">The <see cref="HttpClient"/> to add the headers to.</param>
|
||||
void AddHeader(HttpClient httpClient);
|
||||
}
|
||||
}
|
||||
77
src/Cloudflare/Interfaces/ICloudflareClient.cs
Normal file
77
src/Cloudflare/Interfaces/ICloudflareClient.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a client for the Cloudflare API.
|
||||
/// </summary>
|
||||
public interface ICloudflareClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Makes a GET request to the Cloudflare API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The GET method requests a representation of the specified resource.
|
||||
/// Requests using GET should only retrieve data and should not contain a request content.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TResponse">The response type.</typeparam>
|
||||
/// <param name="requestPath">The request path (extending the base URL).</param>
|
||||
/// <param name="queryFilter">The query parameters.</param>
|
||||
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
||||
Task<CloudflareResponse<TResponse>> GetAsync<TResponse>(string requestPath, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Makes a POST request to the Cloudflare API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The POST method submits an entity to the specified resource, often causing a change in state or side effects on the server.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TResponse">The response type.</typeparam>
|
||||
/// <typeparam name="TRequest">The request type.</typeparam>
|
||||
/// <param name="requestPath">The request path (extending the base URL).</param>
|
||||
/// <param name="request">The request content.</param>
|
||||
/// <param name="queryFilter">The query parameters.</param>
|
||||
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
||||
Task<CloudflareResponse<TResponse>> PostAsync<TResponse, TRequest>(string requestPath, TRequest? request, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Makes a PUT request to the Cloudflare API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The PUT method replaces all current representations of the target resource with the request content.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TResponse">The response type.</typeparam>
|
||||
/// <typeparam name="TRequest">The request type.</typeparam>
|
||||
/// <param name="requestPath">The request path (extending the base URL).</param>
|
||||
/// <param name="request">The request content.</param>
|
||||
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
||||
Task<CloudflareResponse<TResponse>> PutAsync<TResponse, TRequest>(string requestPath, TRequest? request, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Makes a DELETE request to the Cloudflare API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The DELETE method deletes the specified resource.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TResponse">The response type.</typeparam>
|
||||
/// <param name="requestPath">The request path (extending the base URL).</param>
|
||||
/// <param name="queryFilter">The query parameters.</param>
|
||||
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
||||
/// <returns></returns>
|
||||
Task<CloudflareResponse<TResponse>> DeleteAsync<TResponse>(string requestPath, IQueryParameterFilter? queryFilter = null, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Makes a PATCH request to the Cloudflare API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The PATCH method applies partial modifications to a resource.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TResponse">The response type.</typeparam>
|
||||
/// <typeparam name="TRequest">The request type.</typeparam>
|
||||
/// <param name="requestPath">The request path (extending the base URL).</param>
|
||||
/// <param name="request">The request content.</param>
|
||||
/// <param name="cancellationToken">A cancellation token used to propagate notification that this operation should be canceled.</param>
|
||||
Task<CloudflareResponse<TResponse>> PatchAsync<TResponse, TRequest>(string requestPath, TRequest? request, CancellationToken cancellationToken = default);
|
||||
}
|
||||
}
|
||||
13
src/Cloudflare/Interfaces/IQueryParameterFilter.cs
Normal file
13
src/Cloudflare/Interfaces/IQueryParameterFilter.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents filter options defined via query parameters.
|
||||
/// </summary>
|
||||
public interface IQueryParameterFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the query parameters.
|
||||
/// </summary>
|
||||
IDictionary<string, string> GetQueryParameters();
|
||||
}
|
||||
}
|
||||
182
src/Cloudflare/Models/AuditLog.cs
Normal file
182
src/Cloudflare/Models/AuditLog.cs
Normal file
@@ -0,0 +1,182 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// An audit log entry.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L10">Source</see>
|
||||
/// </summary>
|
||||
public class AuditLog
|
||||
{
|
||||
/// <summary>
|
||||
/// A string that uniquely identifies the audit log.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The action that was performed.
|
||||
/// </summary>
|
||||
[JsonProperty("action")]
|
||||
public AuditLogAction? Action { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The actor that performed the action.
|
||||
/// </summary>
|
||||
[JsonProperty("actor")]
|
||||
public AuditLogActor? Actor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The source of the event.
|
||||
/// </summary>
|
||||
[JsonProperty("interface")]
|
||||
public string? Interface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An object which can lend more context to the action being logged.
|
||||
/// This is a flexible value and varies between different actions.
|
||||
/// </summary>
|
||||
[JsonProperty("metadata")]
|
||||
public object? MetaData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The new value of the resource that was modified.
|
||||
/// </summary>
|
||||
[JsonProperty("newValue")]
|
||||
public string? NewValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The value of the resource before it was modified.
|
||||
/// </summary>
|
||||
[JsonProperty("oldValue")]
|
||||
public string? OldValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The owner of the resource that was modified.
|
||||
/// </summary>
|
||||
[JsonProperty("owner")]
|
||||
public AuditLogOwner? Owner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The resource that was modified.
|
||||
/// </summary>
|
||||
[JsonProperty("resource")]
|
||||
public AuditLogResource? Resource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A UTC RFC3339 timestamp that specifies when the action being logged occured.
|
||||
/// </summary>
|
||||
[JsonProperty("when")]
|
||||
public DateTime? When { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The action that was performed.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L52">Soruce</see>
|
||||
/// </summary>
|
||||
public class AuditLogAction
|
||||
{
|
||||
/// <summary>
|
||||
/// A boolean that indicates if the action attempted was successful.
|
||||
/// </summary>
|
||||
[JsonProperty("result")]
|
||||
public bool? Result { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A short string that describes the action that was performed.
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The actor that performed the action.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L64">Source</see>
|
||||
/// </summary>
|
||||
public class AuditLogActor
|
||||
{
|
||||
/// <summary>
|
||||
/// The ID of the actor that performed the action.
|
||||
/// If a user performed the action, this will be the user's ID.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The email of the user that performed the action.
|
||||
/// </summary>
|
||||
[JsonProperty("email")]
|
||||
public string? Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The IP address of the request that performed the action.
|
||||
/// </summary>
|
||||
[JsonProperty("ip")]
|
||||
public string? IpAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of actor, whether a User, Cloudflare Admin, or an Automated System.
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public AuditLogActorType? Type { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The type of actor.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L84">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum AuditLogActorType
|
||||
{
|
||||
/// <summary>
|
||||
/// User interaction.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "user")]
|
||||
User = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Cloudflare admin interaction.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "admin")]
|
||||
Admin = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Cloudflare automated system interaction.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "Cloudflare")]
|
||||
Cloudflare = 3
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The owner of the resource that was modified.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L87">Source</see>
|
||||
/// </summary>
|
||||
public class AuditLogOwner
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifier.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The resource that was modified.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L94">Source</see>
|
||||
/// </summary>
|
||||
public class AuditLogResource
|
||||
{
|
||||
/// <summary>
|
||||
/// An identifier for the resource that was affected by the action.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A short string that describes the resource that was affected by the action.
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
}
|
||||
}
|
||||
44
src/Cloudflare/Models/CloudflareResponse.cs
Normal file
44
src/Cloudflare/Models/CloudflareResponse.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// The base Cloudflare response.
|
||||
/// Derived from <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L616">Source: Result</see>
|
||||
/// </summary>
|
||||
public class CloudflareResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Errors returned by the API call.
|
||||
/// </summary>
|
||||
[JsonProperty("errors")]
|
||||
public IReadOnlyCollection<ResponseInfo>? Errors { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Messages returned by the API call.
|
||||
/// </summary>
|
||||
[JsonProperty("messages")]
|
||||
public IReadOnlyCollection<ResponseInfo>? Messages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the API call was successful.
|
||||
/// </summary>
|
||||
[JsonProperty("success")]
|
||||
public bool Success { get; set; }
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <typeparam name="T">The result type.</typeparam>
|
||||
public class CloudflareResponse<T> : CloudflareResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The result of the API call.
|
||||
/// </summary>
|
||||
[JsonProperty("result")]
|
||||
public T? Result { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Information about the result of the request.
|
||||
/// </summary>
|
||||
[JsonProperty("result_info")]
|
||||
public PaginationInfo? ResultInfo { get; set; }
|
||||
}
|
||||
}
|
||||
229
src/Cloudflare/Models/CloudflareTunnel.cs
Normal file
229
src/Cloudflare/Models/CloudflareTunnel.cs
Normal file
@@ -0,0 +1,229 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A Cloudflare Tunnel that connects your origin to Cloudflare's edge.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L132">Source</see>
|
||||
/// </summary>
|
||||
public class CloudflareTunnel
|
||||
{
|
||||
/// <summary>
|
||||
/// UUID of the tunnel.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cloudflare account ID.
|
||||
/// </summary>
|
||||
[JsonProperty("account_tag")]
|
||||
public string? AccountTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Active connections.
|
||||
/// </summary>
|
||||
[JsonProperty("connections")]
|
||||
[Obsolete("This field will start returning an empty array. To fetch the connections of a given tunnel, please use the dedicated endpoint '/accounts/{account_id}/{tunnel_type}/{tunnel_id}/connections'.")]
|
||||
public IReadOnlyCollection<CloudflareTunnelConnection>? Connections { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of when the tunnel established at least one connection to Cloudflare's edge.
|
||||
/// If <see langword="null"/>, the tunnel is inactive.
|
||||
/// </summary>
|
||||
[JsonProperty("conns_active_at")]
|
||||
public DateTime? ConnectionsActiveAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of when the tunnel became inactive (no connections to Cloudflare's edge).
|
||||
/// If <see langword="null"/>, the tunnel is active.
|
||||
/// </summary>
|
||||
[JsonProperty("conns_inactive_at")]
|
||||
public DateTime? ConnectionsInactiveAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of when the resource was created.
|
||||
/// </summary>
|
||||
[JsonProperty("created_at")]
|
||||
public DateTime? CreatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of when the resource was deleted.
|
||||
/// If <see langword="null"/>, the resource has not been deleted.
|
||||
/// </summary>
|
||||
[JsonProperty("deleted_at")]
|
||||
public DateTime? DeletedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Metadata associated with the tunnel.
|
||||
/// </summary>
|
||||
[JsonProperty("metadata")]
|
||||
public object? MetaData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A user-friendly name for a tunnel.
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If <see langword="true"/>, the tunnel can be configured remotely from the Zero Trust dashboard.
|
||||
/// If <see langword="false"/>, the tunnel must be configured locally on the origin machine.
|
||||
/// </summary>
|
||||
[JsonProperty("remote_config")]
|
||||
public bool? RemoteConfiguration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The status of the tunnel.
|
||||
/// </summary>
|
||||
[JsonProperty("status")]
|
||||
public CloudflareTunnelStatus? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of tunnel.
|
||||
/// </summary>
|
||||
[JsonProperty("tun_type")]
|
||||
public CloudflareTunnelType? TunType { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A connection to Cloudflare's edge.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L204">Source</see>
|
||||
/// </summary>
|
||||
public class CloudflareTunnelConnection
|
||||
{
|
||||
/// <summary>
|
||||
/// UUID of the Cloudflare Tunnel connection.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// UUID of the Cloudflare Tunnel connector.
|
||||
/// </summary>
|
||||
[JsonProperty("client_id")]
|
||||
public string? ClientId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The cloudflared version used to establish this connection.
|
||||
/// </summary>
|
||||
[JsonProperty("client_version")]
|
||||
public string? ClientVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Cloudflare data center used for this connection.
|
||||
/// </summary>
|
||||
[JsonProperty("colo_name")]
|
||||
public string? ColocationName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cloudflare continues to track connections for several minutes after they disconnect.
|
||||
/// This is an optimization to improve latency and reliability of reconnecting.
|
||||
/// <br/>
|
||||
/// If <see langword="true"/>, the connection has disconnected but is still being tracked.
|
||||
/// If <see langword="false"/>, the connection is actively serving traffic.
|
||||
/// </summary>
|
||||
[JsonProperty("is_pending_reconnect")]
|
||||
public bool? IsPendingReconnect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of when the connection was established.
|
||||
/// </summary>
|
||||
[JsonProperty("opened_at")]
|
||||
public DateTime? OpenedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The public IP address of the host running cloudflared.
|
||||
/// </summary>
|
||||
[JsonProperty("origin_ip")]
|
||||
public string? OriginIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// UUID of the Cloudflare Tunnel connection.
|
||||
/// </summary>
|
||||
[JsonProperty("uuid")]
|
||||
public string? UUID { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The status of the tunnel.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L195">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum CloudflareTunnelStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// The tunnel has never been run.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "inactive")]
|
||||
Inactive = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The tunnel is active and able to serve traffic but in an unhealthy state.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "degraded")]
|
||||
Degraded = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The tunnel is active and able to serve traffic.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "healthy")]
|
||||
Healthy = 3,
|
||||
|
||||
/// <summary>
|
||||
/// The tunnel can not serve traffic as it has no connections to the Cloudflare Edge.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "down")]
|
||||
Down = 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The type of tunnel.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L200">Source</see>
|
||||
/// </summary>
|
||||
public enum CloudflareTunnelType
|
||||
{
|
||||
/// <summary>
|
||||
/// Cloudflared.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "cfd_tunnel")]
|
||||
Cloudflared = 1,
|
||||
|
||||
/// <summary>
|
||||
/// WARP Connector.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "warp_connector")]
|
||||
WarpConnector = 2,
|
||||
|
||||
/// <summary>
|
||||
/// WARP.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "warp")]
|
||||
Warp = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Magic WAN.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "magic")]
|
||||
MagicWAN = 4,
|
||||
|
||||
/// <summary>
|
||||
/// IPsec.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ip_sec")]
|
||||
IpSec = 5,
|
||||
|
||||
/// <summary>
|
||||
/// GRE.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "gre")]
|
||||
Gre = 6,
|
||||
|
||||
/// <summary>
|
||||
/// CNI.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "cni")]
|
||||
Cni = 7
|
||||
}
|
||||
}
|
||||
46
src/Cloudflare/Models/ErrorData.cs
Normal file
46
src/Cloudflare/Models/ErrorData.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// An error message.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L250">Source</see>
|
||||
/// </summary>
|
||||
public class ErrorData
|
||||
{
|
||||
/// <summary>
|
||||
/// The error code.
|
||||
/// </summary>
|
||||
[JsonProperty("code")]
|
||||
public int? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A link to documentation about the error.
|
||||
/// </summary>
|
||||
[JsonProperty("documentation_url")]
|
||||
public string? DocumentationUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The error message.
|
||||
/// </summary>
|
||||
[JsonProperty("message")]
|
||||
public string? Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The source of the error.
|
||||
/// </summary>
|
||||
[JsonProperty("source")]
|
||||
public ErrorDataSource? Source { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The source of the error.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L261">Source</see>
|
||||
/// </summary>
|
||||
public class ErrorDataSource
|
||||
{
|
||||
/// <summary>
|
||||
/// The pointer to the source of the error.
|
||||
/// </summary>
|
||||
[JsonProperty("pointer")]
|
||||
public string? Pointer { get; set; }
|
||||
}
|
||||
}
|
||||
15
src/Cloudflare/Models/Identifier.cs
Normal file
15
src/Cloudflare/Models/Identifier.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A Cloudflare identifier.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L266">Source</see>
|
||||
/// </summary>
|
||||
public class Identifier
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifier.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
}
|
||||
}
|
||||
21
src/Cloudflare/Models/LoadBalancerPreview.cs
Normal file
21
src/Cloudflare/Models/LoadBalancerPreview.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A load balancer preview.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L273">Source</see>
|
||||
/// </summary>
|
||||
public class LoadBalancerPreview
|
||||
{
|
||||
/// <summary>
|
||||
/// Monitored pool IDs mapped to their respective names.
|
||||
/// </summary>
|
||||
[JsonProperty("pools")]
|
||||
public IDictionary<string, string>? Pools { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preview ID.
|
||||
/// </summary>
|
||||
[JsonProperty("preview_id")]
|
||||
public string? PreviewId { get; set; }
|
||||
}
|
||||
}
|
||||
321
src/Cloudflare/Models/Member.cs
Normal file
321
src/Cloudflare/Models/Member.cs
Normal file
@@ -0,0 +1,321 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A Cloudflare member.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L282">Source</see>
|
||||
/// </summary>
|
||||
public class Member
|
||||
{
|
||||
/// <summary>
|
||||
/// Membership identifier tag.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Access policy for the membership.
|
||||
/// </summary>
|
||||
[JsonProperty("policies")]
|
||||
public IReadOnlyCollection<MemberPolicy>? Policies { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Roles assigned to this Member.
|
||||
/// </summary>
|
||||
[JsonProperty("roles")]
|
||||
public IReadOnlyCollection<Role>? Roles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A member's status in the account.
|
||||
/// </summary>
|
||||
[JsonProperty("status")]
|
||||
public MemberStatus? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Details of the user associated to the membership.
|
||||
/// </summary>
|
||||
[JsonProperty("user")]
|
||||
public MemberUser? User { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A member's access policy.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L310">Source</see>
|
||||
/// </summary>
|
||||
public class MemberPolicy
|
||||
{
|
||||
/// <summary>
|
||||
/// Policy identifier.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Allow or deny operations against the resources.
|
||||
/// </summary>
|
||||
[JsonProperty("access")]
|
||||
public MemberPolicyAccess? Access { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A set of permission groups that are specified to the policy.
|
||||
/// </summary>
|
||||
[JsonProperty("permission_groups")]
|
||||
public IReadOnlyCollection<MemberPolicyPermissionGroup>? PermissionGroups { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of resource groups that the policy applies to.
|
||||
/// </summary>
|
||||
[JsonProperty("resource_groups")]
|
||||
public IReadOnlyCollection<MemberPolicyResourceGroup>? ResourceGroups { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A member's status.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L301">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum MemberStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// The member has accepted the invitation.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "accepted")]
|
||||
Accepted = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The member has not yet accepted the invitation.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "pending")]
|
||||
Pending = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A member's policy access.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L319">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum MemberPolicyAccess
|
||||
{
|
||||
/// <summary>
|
||||
/// Allow operations against the resource.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "allow")]
|
||||
Allow = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Deny operations against the resource.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "deny")]
|
||||
Deny = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A member's permission group.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L337">Source</see>
|
||||
/// </summary>
|
||||
public class MemberPolicyPermissionGroup
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MemberPolicyPermissionGroup"/> class.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier of the permission group.</param>
|
||||
public MemberPolicyPermissionGroup(string id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifier of the permission group.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attributes associated to the permission group.
|
||||
/// </summary>
|
||||
[JsonProperty("meta")]
|
||||
public MemberPolicyPermissionGroupMeta? Meta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the permission group.
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attributes associated to the permission group.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L358">Source</see>
|
||||
/// </summary>
|
||||
public class MemberPolicyPermissionGroupMeta
|
||||
{
|
||||
/// <summary>
|
||||
/// The key of the attribute.
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The value of the attribute.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A group of scoped resources.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L368">Source</see>
|
||||
/// </summary>
|
||||
public class MemberPolicyResourceGroup
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MemberPolicyResourceGroup"/> class.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier of the resource group.</param>
|
||||
public MemberPolicyResourceGroup(string id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifier of the resource group.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The scope associated to the resource group.
|
||||
/// </summary>
|
||||
[JsonProperty("scope")]
|
||||
public IReadOnlyCollection<MemberPolicyResourceGroupScope> Scope { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Attributes associated to the resource group.
|
||||
/// </summary>
|
||||
[JsonProperty("meta")]
|
||||
public MemberPolicyResourceGroupMeta? Meta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the resource group.
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attributes associated to the resource group.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L394">Source</see>
|
||||
/// </summary>
|
||||
public class MemberPolicyResourceGroupScope
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MemberPolicyResourceGroupScope"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">Combination of pre-defined resource name and identifier.</param>
|
||||
public MemberPolicyResourceGroupScope(string key)
|
||||
{
|
||||
Key = key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is a combination of pre-defined resource name and identifier (like Account ID etc.)
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of scope objects for additional context.
|
||||
/// </summary>
|
||||
[JsonProperty("objects")]
|
||||
public IReadOnlyCollection<MemberPolicyResourceGroupScopeObject> Objects { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A scope object for additional context.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L412">Source</see>
|
||||
/// </summary>
|
||||
public class MemberPolicyResourceGroupScopeObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MemberPolicyResourceGroupScopeObject"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">Combination of pre-defined resource name and identifier.</param>
|
||||
public MemberPolicyResourceGroupScopeObject(string key)
|
||||
{
|
||||
Key = key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is a combination of pre-defined resource name and identifier (like Zone ID etc.)
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string Key { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attributes associated to the resource group.
|
||||
/// </summary>
|
||||
public class MemberPolicyResourceGroupMeta
|
||||
{
|
||||
/// <summary>
|
||||
/// The key of the attribute.
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The value of the attribute.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Details of the user associated to the membership.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L435">Source</see>
|
||||
/// </summary>
|
||||
public class MemberUser
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MemberUser"/> class.
|
||||
/// </summary>
|
||||
/// <param name="email">The contact email address of the user.</param>
|
||||
public MemberUser(string email)
|
||||
{
|
||||
Email = email;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The contact email address of the user.
|
||||
/// </summary>
|
||||
[JsonProperty("email")]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Identifier.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's first name.
|
||||
/// </summary>
|
||||
[JsonProperty("first_name")]
|
||||
public string? FirstName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's last name.
|
||||
/// </summary>
|
||||
[JsonProperty("last_name")]
|
||||
public string? LastName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether two-factor authentication is enabled for the user account.
|
||||
/// Does not apply to API authentication.
|
||||
/// </summary>
|
||||
[JsonProperty("two_factor_authentication_enabled")]
|
||||
public bool? TwoFactorAuthEnabled { get; set; }
|
||||
}
|
||||
}
|
||||
33
src/Cloudflare/Models/PaginationInfo.cs
Normal file
33
src/Cloudflare/Models/PaginationInfo.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// Information about pagination.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L464">Source</see>
|
||||
/// </summary>
|
||||
public class PaginationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Total number of results for the requested service.
|
||||
/// </summary>
|
||||
[JsonProperty("count")]
|
||||
public int? Count { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current page within paginated list of results.
|
||||
/// </summary>
|
||||
[JsonProperty("page")]
|
||||
public int? Page { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of results per page of results.
|
||||
/// </summary>
|
||||
[JsonProperty("per_page")]
|
||||
public int? PerPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total results available without any search parameters.
|
||||
/// </summary>
|
||||
[JsonProperty("total_count")]
|
||||
public int? TotalCount { get; set; }
|
||||
}
|
||||
}
|
||||
21
src/Cloudflare/Models/PermissionGrant.cs
Normal file
21
src/Cloudflare/Models/PermissionGrant.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A permission grant.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L488">Source</see>
|
||||
/// </summary>
|
||||
public class PermissionGrant
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the member can read the resource.
|
||||
/// </summary>
|
||||
[JsonProperty("read")]
|
||||
public bool? CanRead { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the member can write to the resource.
|
||||
/// </summary>
|
||||
[JsonProperty("write")]
|
||||
public bool? CanWrite { get; set; }
|
||||
}
|
||||
}
|
||||
122
src/Cloudflare/Models/RatePlan.cs
Normal file
122
src/Cloudflare/Models/RatePlan.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// The rate plan applied to the subscription.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L503">Source</see>
|
||||
/// </summary>
|
||||
public class RatePlan
|
||||
{
|
||||
/// <summary>
|
||||
/// The ID of the rate plan.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public RatePlanId? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The currency applied to the rate plan subscription.
|
||||
/// </summary>
|
||||
[JsonProperty("currency")]
|
||||
public string? Currency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this rate plan is managed externally from Cloudflare.
|
||||
/// </summary>
|
||||
[JsonProperty("externally_managed")]
|
||||
public bool? ExternallyManaged { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether a rate plan is enterprise-based (or newly adopted term contract).
|
||||
/// </summary>
|
||||
[JsonProperty("is_contract")]
|
||||
public bool? IsContract { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The full name of the rate plan.
|
||||
/// </summary>
|
||||
[JsonProperty("public_name")]
|
||||
public string? PublicName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The scope that this rate plan applies to.
|
||||
/// </summary>
|
||||
[JsonProperty("scope")]
|
||||
public string? Scope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The list of sets this rate plan applies to.
|
||||
/// </summary>
|
||||
[JsonProperty("sets")]
|
||||
public IReadOnlyCollection<string>? Sets { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Available rate plan ids.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L507">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum RatePlanId
|
||||
{
|
||||
/// <summary>
|
||||
/// The free rate plan.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "free")]
|
||||
Free = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The lite rate plan.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "lite")]
|
||||
Lite = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The pro rate plan.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "pro")]
|
||||
Pro = 3,
|
||||
|
||||
/// <summary>
|
||||
/// The pro+ rate plan.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "pro_plus")]
|
||||
ProPlus = 4,
|
||||
|
||||
/// <summary>
|
||||
/// The business rate plan.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "business")]
|
||||
Business = 5,
|
||||
|
||||
/// <summary>
|
||||
/// The enterprise rate plan.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "enterprise")]
|
||||
Enterprise = 6,
|
||||
|
||||
/// <summary>
|
||||
/// The partners free rate plan.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "partners_free")]
|
||||
PartnersFree = 7,
|
||||
|
||||
/// <summary>
|
||||
/// The partners pro rate plan.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "partners_pro")]
|
||||
PartnersPro = 8,
|
||||
|
||||
/// <summary>
|
||||
/// The partners business rate plan.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "partners_business")]
|
||||
PartnersBusiness = 9,
|
||||
|
||||
/// <summary>
|
||||
/// The partners enterprise rate plan.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "partners_enterprise")]
|
||||
PartnersEnterprise = 10
|
||||
}
|
||||
}
|
||||
57
src/Cloudflare/Models/ResponseInfo.cs
Normal file
57
src/Cloudflare/Models/ResponseInfo.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A response info.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L600">Source</see>
|
||||
/// </summary>
|
||||
public class ResponseInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ResponseInfo"/> class.
|
||||
/// </summary>
|
||||
/// <param name="code">The response code.</param>
|
||||
/// <param name="message">The response message.</param>
|
||||
public ResponseInfo(int code, string message)
|
||||
{
|
||||
Code = code;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The response code.
|
||||
/// </summary>
|
||||
[JsonProperty("code")]
|
||||
public int Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The response message.
|
||||
/// </summary>
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The documentation URL.
|
||||
/// </summary>
|
||||
[JsonProperty("documentation_url")]
|
||||
public string? DocumentationUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The response source.
|
||||
/// </summary>
|
||||
[JsonProperty("source")]
|
||||
public ResponseInfoSource? Source { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A response info source.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L611">Source</see>
|
||||
/// </summary>
|
||||
public class ResponseInfoSource
|
||||
{
|
||||
/// <summary>
|
||||
/// The pointer.
|
||||
/// </summary>
|
||||
[JsonProperty("pointer")]
|
||||
public string? Pointer { get; set; }
|
||||
}
|
||||
}
|
||||
127
src/Cloudflare/Models/Role.cs
Normal file
127
src/Cloudflare/Models/Role.cs
Normal file
@@ -0,0 +1,127 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A Cloudflare role.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L641">Source</see>
|
||||
/// </summary>
|
||||
public class Role
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Role"/> class.
|
||||
/// </summary>
|
||||
/// <param name="id">Role identifier tag.</param>
|
||||
/// <param name="name">Role name.</param>
|
||||
/// <param name="description">Description of role's permissions.</param>
|
||||
/// <param name="permissions">Permissions.</param>
|
||||
public Role(string id, string name, string description, RolePermissions permissions)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
Description = description;
|
||||
Permissions = permissions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Role identifier tag.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description of role's permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Role name.
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Role permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("permissions")]
|
||||
public RolePermissions Permissions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Role permissions.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L661">Source</see>
|
||||
/// </summary>
|
||||
public class RolePermissions
|
||||
{
|
||||
/// <summary>
|
||||
/// Analytics permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("analytics")]
|
||||
public PermissionGrant? Analytics { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Billing permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("billing")]
|
||||
public PermissionGrant? Billing { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cache Purge permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("cache_purge")]
|
||||
public PermissionGrant? CachePurge { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DNS permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("dns")]
|
||||
public PermissionGrant? Dns { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DNS Records permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("dns_records")]
|
||||
public PermissionGrant? DnsRecords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Load Balancer permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("lb")]
|
||||
public PermissionGrant? LoadBalancer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Logs permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("logs")]
|
||||
public PermissionGrant? Logs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Organization permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("organization")]
|
||||
public PermissionGrant? Organization { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SSL permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("ssl")]
|
||||
public PermissionGrant? Ssl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// WAF permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("waf")]
|
||||
public PermissionGrant? WebApplicationFirewall { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Zone Settings permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("zone_settings")]
|
||||
public PermissionGrant? ZoneSettings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Zones permissions.
|
||||
/// </summary>
|
||||
[JsonProperty("zones")]
|
||||
public PermissionGrant? Zones { get; set; }
|
||||
}
|
||||
}
|
||||
110
src/Cloudflare/Models/Subscription.cs
Normal file
110
src/Cloudflare/Models/Subscription.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A Cloudflare subscription.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L705">Source</see>
|
||||
/// </summary>
|
||||
public class Subscription
|
||||
{
|
||||
/// <summary>
|
||||
/// Subscription identifier tag.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The monetary unit in which pricing information is displayed.
|
||||
/// </summary>
|
||||
[JsonProperty("currency")]
|
||||
public string? Currency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The end of the current period and also when the next billing is due.
|
||||
/// </summary>
|
||||
[JsonProperty("current_period_end")]
|
||||
public DateTime? CurrentPeriodEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When the current billing period started.
|
||||
/// </summary>
|
||||
[JsonProperty("current_period_start")]
|
||||
public DateTime? CurrentPeriodStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// How often the subscription is renewed automatically.
|
||||
/// </summary>
|
||||
[JsonProperty("frequency")]
|
||||
public RenewFrequency? Frequency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The price of the subscription that will be billed, in US dollars.
|
||||
/// </summary>
|
||||
[JsonProperty("price")]
|
||||
public decimal? Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The rate plan applied to the subscription.
|
||||
/// </summary>
|
||||
[JsonProperty("rate_plan")]
|
||||
public RatePlan? RatePlan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The state that the subscription is in.
|
||||
/// </summary>
|
||||
[JsonProperty("state")]
|
||||
public SubscriptionState? State { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The state that the subscription is in.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L745">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum SubscriptionState
|
||||
{
|
||||
/// <summary>
|
||||
/// The subscription is in the trial period.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "Trial")]
|
||||
Trial = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The subscription is provisioned.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "Provisioned")]
|
||||
Provisioned = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The subscription is paid.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "Paid")]
|
||||
Paid = 3,
|
||||
|
||||
/// <summary>
|
||||
/// The subscription is awaiting payment.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "AwaitingPayment")]
|
||||
AwaitingPayment = 4,
|
||||
|
||||
/// <summary>
|
||||
/// The subscription is cancelled.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "Cancelled")]
|
||||
Cancelled = 5,
|
||||
|
||||
/// <summary>
|
||||
/// The subscription has failed.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "Failed")]
|
||||
Failed = 6,
|
||||
|
||||
/// <summary>
|
||||
/// The subscription has expired.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "Expired")]
|
||||
Expired = 7
|
||||
}
|
||||
}
|
||||
33
src/Cloudflare/Models/SubscriptionComponent.cs
Normal file
33
src/Cloudflare/Models/SubscriptionComponent.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A component value for a subscription.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L751">Source</see>
|
||||
/// </summary>
|
||||
public class SubscriptionComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The default amount assigned.
|
||||
/// </summary>
|
||||
[JsonProperty("default")]
|
||||
public int? Default { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the component value.
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The unit price for the component value.
|
||||
/// </summary>
|
||||
[JsonProperty("price")]
|
||||
public decimal? Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of the component value assigned.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public int? Value { get; set; }
|
||||
}
|
||||
}
|
||||
21
src/Cloudflare/Models/SubscriptionZone.cs
Normal file
21
src/Cloudflare/Models/SubscriptionZone.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple zone object. May have null properties if not a zone subscription.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L776">Source</see>
|
||||
/// </summary>
|
||||
public class SubscriptionZone
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifier.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The domain name.
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
||||
123
src/Cloudflare/Models/Token.cs
Normal file
123
src/Cloudflare/Models/Token.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A token.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L788">Source</see>
|
||||
/// </summary>
|
||||
public class Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Token identifier tag.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Token condition.
|
||||
/// </summary>
|
||||
[JsonProperty("condition")]
|
||||
public TokenCondition? Condition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The expiration time on or after which the JWT MUST NOT be accepted for processing.
|
||||
/// </summary>
|
||||
[JsonProperty("created_on")]
|
||||
public DateTime? ExpiresOn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time on which the token was created.
|
||||
/// </summary>
|
||||
public DateTime? IssuedOn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last time the token was used.
|
||||
/// </summary>
|
||||
public DateTime? LastUsedOn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last time the token was modified.
|
||||
/// </summary>
|
||||
public DateTime? ModifiedOn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Token name.
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time before which the token MUST NOT be accepted for processing.
|
||||
/// </summary>
|
||||
public DateTime? NotBefore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of access policies assigned to the token.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<TokenPolicy>? Policies { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Status of the token.
|
||||
/// </summary>
|
||||
public TokenStatus? Status { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Token condition.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L839">Source</see>
|
||||
/// </summary>
|
||||
public class TokenCondition
|
||||
{
|
||||
/// <summary>
|
||||
/// Client IP restrictions.
|
||||
/// </summary>
|
||||
[JsonProperty("request_ip")]
|
||||
public TokenConditionRequestIP? RequestIp { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Client IP restrictions.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L850">Source</see>
|
||||
/// </summary>
|
||||
public class TokenConditionRequestIP
|
||||
{
|
||||
/// <summary>
|
||||
/// List of IPv4/IPv6 CIDR addresses.
|
||||
/// </summary>
|
||||
[JsonProperty("in")]
|
||||
public IReadOnlyCollection<string>? Allowed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of IPv4/IPv6 CIDR addresses.
|
||||
/// </summary>
|
||||
[JsonProperty("not_in")]
|
||||
public IReadOnlyCollection<string>? Denied { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Status of the token.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L835">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum TokenStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// The token is active.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "active")]
|
||||
Active = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The token is disabled.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "disabled")]
|
||||
Disabled = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The token is expired.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "expired")]
|
||||
Expired = 3
|
||||
}
|
||||
}
|
||||
120
src/Cloudflare/Models/TokenPolicy.cs
Normal file
120
src/Cloudflare/Models/TokenPolicy.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare
|
||||
{
|
||||
/// <summary>
|
||||
/// A token policy.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L874">Source</see>
|
||||
/// </summary>
|
||||
public class TokenPolicy
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TokenPolicy"/> class.
|
||||
/// </summary>
|
||||
/// <param name="id">Policy identifier.</param>
|
||||
/// <param name="effect">Allow or deny operations against the resources.</param>
|
||||
public TokenPolicy(string id, TokenPolicyEffect effect)
|
||||
{
|
||||
Id = id;
|
||||
Effect = effect;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Policy identifier.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Allow or deny operations against the resources.
|
||||
/// </summary>
|
||||
[JsonProperty("effect")]
|
||||
public TokenPolicyEffect Effect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A set of permission groups that are specified to the policy.
|
||||
/// </summary>
|
||||
[JsonProperty("permission_groups")]
|
||||
public IReadOnlyCollection<TokenPolicyPermissionGroup> PermissionGroups { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// A list of resource names that the policy applies to.
|
||||
/// </summary>
|
||||
[JsonProperty("resources")]
|
||||
public IDictionary<string, string> Resources { get; set; } = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allow or deny operations against the resources.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L883">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum TokenPolicyEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// Allow operations against the resources.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "allow")]
|
||||
Allow = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Deny operations against the resources.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "deny")]
|
||||
Deny = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A named group of permissions that map to a group of operations against resources.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L901">Source</see>
|
||||
/// </summary>
|
||||
public class TokenPolicyPermissionGroup
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TokenPolicyPermissionGroup"/> class.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier of the permission group.</param>
|
||||
public TokenPolicyPermissionGroup(string id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifier of the permission group.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attributes associated to the permission group.
|
||||
/// </summary>
|
||||
[JsonProperty("meta")]
|
||||
public TokenPolicyPermissionGroupMeta? Meta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the permission group.
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attributes associated to the permission group.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/shared.ts#L922">Source</see>
|
||||
/// </summary>
|
||||
public class TokenPolicyPermissionGroupMeta
|
||||
{
|
||||
/// <summary>
|
||||
/// Key.
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Value.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
}
|
||||
21
src/Cloudflare/README.md
Normal file
21
src/Cloudflare/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Cloudflare API for .NET | Core
|
||||
|
||||
This is the core package for all extensions of the Cloudflare API implemented by [AM.WD].
|
||||
|
||||
## Contents
|
||||
|
||||
- The `(I)CloudflareClient` with base calls for `GET`, `POST`, `PUT`, `PATCH` and `DELETE` requests.
|
||||
- Base classes to receive responses.
|
||||
- `CloudflareException` to specify some errors.
|
||||
- `IAuthentication` implementations to allow API-Token and API-Key (legacy) authentication.
|
||||
|
||||
Any specific request will be defined via extension packages.
|
||||
|
||||
---
|
||||
|
||||
Published under MIT License (see [choose a license])
|
||||
|
||||
|
||||
|
||||
[AM.WD]: https://www.nuget.org/packages?q=AMWD.&sortby=created-desc
|
||||
[choose a license]: https://choosealicense.com/licenses/mit/
|
||||
51
src/Directory.Build.props
Normal file
51
src/Directory.Build.props
Normal file
@@ -0,0 +1,51 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Nullable>enable</Nullable>
|
||||
<NrtRevisionFormat>{semvertag:main}{!:-dev}</NrtRevisionFormat>
|
||||
|
||||
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
|
||||
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
||||
<PackageIcon>package-icon.png</PackageIcon>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageProjectUrl>https://developers.cloudflare.com/api</PackageProjectUrl>
|
||||
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
|
||||
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
<EmbedUntrackedSources>false</EmbedUntrackedSources>
|
||||
|
||||
<Title>Modular Cloudflare API implementation in .NET</Title>
|
||||
<Company>AM.WD</Company>
|
||||
<Authors>Andreas Müller</Authors>
|
||||
<Copyright>© {copyright:2025-} AM.WD</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(GITLAB_CI)' == 'true'">
|
||||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(GITLAB_CI)' == 'true'">
|
||||
<SourceLinkGitLabHost Include="$(CI_SERVER_HOST)" Version="$(CI_SERVER_VERSION)" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitLab" Version="8.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="$(SolutionDir)/package-icon.png" Pack="true" PackagePath="/" />
|
||||
<None Include="$(SolutionDir)/LICENSE.txt" Pack="true" PackagePath="/" />
|
||||
<None Include="README.md" Pack="true" PackagePath="/" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AMWD.NetRevisionTask" Version="1.2.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)\..'))" />
|
||||
</Project>
|
||||
26
src/Extensions/Cloudflare.Zones/Cloudflare.Zones.csproj
Normal file
26
src/Extensions/Cloudflare.Zones/Cloudflare.Zones.csproj
Normal file
@@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<NrtTagMatch>zones/v[0-9]*</NrtTagMatch>
|
||||
|
||||
<PackageId>AMWD.Net.API.Cloudflare.Zones</PackageId>
|
||||
<PackageTags>cloudflare api zones</PackageTags>
|
||||
|
||||
<AssemblyName>amwd-cloudflare-zones</AssemblyName>
|
||||
<RootNamespace>AMWD.Net.Api.Cloudflare.Zones</RootNamespace>
|
||||
|
||||
<Product>Cloudflare API - Domain/Zone Management</Product>
|
||||
<Description>The Domain/Zone Management section of the Cloudflare API.</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Only build package for tagged releases or Debug on CI (only dev NuGet feed) -->
|
||||
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(CI_COMMIT_TAG)', '^zones\/v[0-9.]+')) or ('$(Configuration)' == 'Debug' and '$(GITLAB_CI)' == 'true')">
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="Cloudflare.Zones.Tests" PublicKey="$(PublicKey)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
31
src/Extensions/Cloudflare.Zones/Enums/OnOffCustomState.cs
Normal file
31
src/Extensions/Cloudflare.Zones/Enums/OnOffCustomState.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Value states on/off/custom.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L591">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum OnOffCustomState
|
||||
{
|
||||
/// <summary>
|
||||
/// On state.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "on")]
|
||||
On = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Off state.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "off")]
|
||||
Off = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Custom state.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "custom")]
|
||||
Custom = 3
|
||||
}
|
||||
}
|
||||
31
src/Extensions/Cloudflare.Zones/Enums/OnOffOpenState.cs
Normal file
31
src/Extensions/Cloudflare.Zones/Enums/OnOffOpenState.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Value states on/off/open.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L704">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum OnOffOpenState
|
||||
{
|
||||
/// <summary>
|
||||
/// On state.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "on")]
|
||||
On = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Off state.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "off")]
|
||||
Off = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Custom state.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "open")]
|
||||
Open = 4
|
||||
}
|
||||
}
|
||||
25
src/Extensions/Cloudflare.Zones/Enums/OnOffState.cs
Normal file
25
src/Extensions/Cloudflare.Zones/Enums/OnOffState.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Value states on/off.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L71">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum OnOffState
|
||||
{
|
||||
/// <summary>
|
||||
/// On state.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "on")]
|
||||
On = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Off state.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "off")]
|
||||
Off = 2
|
||||
}
|
||||
}
|
||||
352
src/Extensions/Cloudflare.Zones/Enums/ZoneSettingId.cs
Normal file
352
src/Extensions/Cloudflare.Zones/Enums/ZoneSettingId.cs
Normal file
@@ -0,0 +1,352 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// The zone setting ID.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum ZoneSettingId
|
||||
{
|
||||
/// <summary>
|
||||
/// Advanced protection from Distributed Denial of Service (DDoS) attacks on your
|
||||
/// website.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "advanced_ddos")]
|
||||
AdvancedDDoS = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Aegis provides dedicated egress IPs (from Cloudflare to your origin) for your
|
||||
/// layer 7 WAF and CDN services.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "aegis")]
|
||||
Aegis = 2,
|
||||
|
||||
/// <summary>
|
||||
/// When enabled, Cloudflare serves limited copies of web pages available from the
|
||||
/// Internet Archive's Wayback Machine if your server is offline.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "always_online")]
|
||||
AlwaysOnline = 3,
|
||||
|
||||
/// <summary>
|
||||
/// If enabled, any <c>http://</c> URL is converted to <c>https://</c> through a 301
|
||||
/// redirect.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "always_use_https")]
|
||||
AlwaysUseHTTPS = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Turn on or off Automatic HTTPS Rewrites.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "automatic_https_rewrites")]
|
||||
AutomaticHTTPSRewrites = 5,
|
||||
|
||||
/// <summary>
|
||||
/// Brotli Compression.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "brotli")]
|
||||
Brotli = 6,
|
||||
|
||||
/// <summary>
|
||||
/// Control how long resources cached by client browsers remain valid.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "browser_cache_ttl")]
|
||||
BrowserCacheTTL = 7,
|
||||
|
||||
/// <summary>
|
||||
/// Inspect the visitor's browser for headers commonly associated with spammers and
|
||||
/// certain bots.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "browser_check")]
|
||||
BrowserCheck = 8,
|
||||
|
||||
/// <summary>
|
||||
/// Apply custom caching based on the option selected.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "cache_level")]
|
||||
CacheLevel = 9,
|
||||
|
||||
/// <summary>
|
||||
/// Specify how long a visitor is allowed access to your site after successfully completing a challenge.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "challenge_ttl")]
|
||||
ChallengeTTL = 10,
|
||||
|
||||
/// <summary>
|
||||
/// An allowlist of ciphers for TLS termination.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ciphers")]
|
||||
Ciphers = 11,
|
||||
|
||||
/// <summary>
|
||||
/// Development Mode temporarily allows you to enter development mode for your
|
||||
/// websites if you need to make changes to your site.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "development_mode")]
|
||||
DevelopmentMode = 12,
|
||||
|
||||
/// <summary>
|
||||
/// When enabled, Cloudflare will attempt to speed up overall page loads.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "early_hints")]
|
||||
EarlyHints = 13,
|
||||
|
||||
/// <summary>
|
||||
/// Email obfuscation.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "email_obfuscation")]
|
||||
EmailObfuscation = 14,
|
||||
|
||||
/// <summary>
|
||||
/// Enhance your website's font delivery with Cloudflare Fonts.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "fonts")]
|
||||
FontSettings = 15,
|
||||
|
||||
/// <summary>
|
||||
/// HTTP/2 Edge Prioritization optimises the delivery of resources served through
|
||||
/// HTTP/2 to improve page load performance.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "h2_prioritization")]
|
||||
H2Prioritization = 16,
|
||||
|
||||
/// <summary>
|
||||
/// Hotlink Protection option ensures that other sites cannot suck
|
||||
/// up your bandwidth by building pages that use images hosted on your site.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "hotlink_protection")]
|
||||
HotlinkProtection = 17,
|
||||
|
||||
/// <summary>
|
||||
/// HTTP/2 option.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "http2")]
|
||||
HTTP2 = 18,
|
||||
|
||||
/// <summary>
|
||||
/// HTTP/3 option.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "http3")]
|
||||
HTTP3 = 19,
|
||||
|
||||
/// <summary>
|
||||
/// Image Transformations provides on-demand resizing, conversion and optimization.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "image_resizing")]
|
||||
ImageResizing = 20,
|
||||
|
||||
/// <summary>
|
||||
/// Cloudflare adds a header with the visitor's country.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ip_geolocation")]
|
||||
IPGeolocation = 21,
|
||||
|
||||
/// <summary>
|
||||
/// Enable IPv6 on all subdomains that are Cloudflare enabled.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ipv6")]
|
||||
IPV6 = 22,
|
||||
|
||||
/// <summary>
|
||||
/// Only accepts HTTPS requests that use at least the TLS protocol version specified.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "min_tls_version")]
|
||||
MinTLSVersion = 23,
|
||||
|
||||
/// <summary>
|
||||
/// Cloudflare Mirage reduces bandwidth used by images in mobile browsers.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "mirage")]
|
||||
Mirage = 24,
|
||||
|
||||
/// <summary>
|
||||
/// Network Error Logging.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "nel")]
|
||||
NEL = 25,
|
||||
|
||||
/// <summary>
|
||||
/// Opportunistic Encryption allows browsers to access HTTP URIs over an encrypted TLS channel.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "opportunistic_encryption")]
|
||||
OpportunisticEncryption = 26,
|
||||
|
||||
/// <summary>
|
||||
/// Add an Alt-Svc header to all legitimate requests from Tor.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "opportunistic_onion")]
|
||||
OpportunisticOnion = 27,
|
||||
|
||||
/// <summary>
|
||||
/// Orange to Orange option.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "orange_to_orange")]
|
||||
OrangeToOrange = 28,
|
||||
|
||||
/// <summary>
|
||||
/// Cloudflare error pages generated from issues sent from the origin server.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "origin_error_page_pass_thru")]
|
||||
OriginErrorPagePassThru = 29,
|
||||
|
||||
/// <summary>
|
||||
/// Only accepts HTTP requests that use at least the HTTP protocol version specified.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "origin_max_http_version")]
|
||||
OriginMaxHTTPVersion = 30,
|
||||
|
||||
/// <summary>
|
||||
/// Polish feature of the Cloudflare Speed app.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "polish")]
|
||||
Polish = 31,
|
||||
|
||||
/// <summary>
|
||||
/// Cloudflare will prefetch any URLs that are included in the response headers.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "prefetch_preload")]
|
||||
PrefetchPreload = 32,
|
||||
|
||||
/// <summary>
|
||||
/// Proxy Read Timeout.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "proxy_read_timeout")]
|
||||
ProxyReadTimeout = 33,
|
||||
|
||||
/// <summary>
|
||||
/// Pseudo IPv4.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "pseudo_ipv4")]
|
||||
PseudoIPV4 = 34,
|
||||
|
||||
/// <summary>
|
||||
/// Turn on or off whether Cloudflare should wait for an entire file from the origin.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "response_buffering")]
|
||||
ResponseBuffering = 35,
|
||||
|
||||
/// <summary>
|
||||
/// Rocket Loader in the Cloudflare Speed app.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "rocket_loader")]
|
||||
RocketLoader = 36,
|
||||
|
||||
/// <summary>
|
||||
/// Security Headers.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "security_header")]
|
||||
SecurityHeaders = 37,
|
||||
|
||||
/// <summary>
|
||||
/// Security Level feature from the Security app.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "security_level")]
|
||||
SecurityLevel = 38,
|
||||
|
||||
/// <summary>
|
||||
/// Server-Side Excludes.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "server_side_excludes")]
|
||||
ServerSideExcludes = 39,
|
||||
|
||||
/// <summary>
|
||||
/// Sort Query String for Cache.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "sort_query_string_for_cache")]
|
||||
SortQueryStringForCache = 40,
|
||||
|
||||
/// <summary>
|
||||
/// SSL.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ssl")]
|
||||
SSL = 41,
|
||||
|
||||
/// <summary>
|
||||
/// Enrollment value for SSL/TLS Recommender.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ssl_recommender")]
|
||||
SSLRecommender = 42,
|
||||
|
||||
/// <summary>
|
||||
/// TLS 1.3.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "tls_1_3")]
|
||||
TLS1_3 = 43,
|
||||
|
||||
/// <summary>
|
||||
/// TLS Client Authentication.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "tls_client_auth")]
|
||||
TLSClientAuth = 44,
|
||||
|
||||
/// <summary>
|
||||
/// True Client IP Header.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "true_client_ip_header")]
|
||||
TrueClientIPHeader = 45,
|
||||
|
||||
/// <summary>
|
||||
/// Web Application Firewall.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "waf")]
|
||||
WAF = 46,
|
||||
|
||||
/// <summary>
|
||||
/// Cloudflare will serve a WebP version of the original image.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "webp")]
|
||||
WebP = 47,
|
||||
|
||||
/// <summary>
|
||||
/// WebSockets settings.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "websockets")]
|
||||
Websocket = 48,
|
||||
|
||||
/// <summary>
|
||||
/// 0-RTT
|
||||
/// </summary>
|
||||
[EnumMember(Value = "0rtt")]
|
||||
ZeroRTT = 49,
|
||||
|
||||
/// <summary>
|
||||
/// Edge Cache TTL.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "edge_cache_ttl")]
|
||||
SchemasEdgeCacheTTL = 501,
|
||||
|
||||
/// <summary>
|
||||
/// Maximum size of an allowable upload.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "max_upload")]
|
||||
MaxUpload = 502,
|
||||
|
||||
/// <summary>
|
||||
/// Replace insecure JS.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "replace_insecure_js")]
|
||||
ReplaceInsecureJS = 503,
|
||||
|
||||
/// <summary>
|
||||
/// Only allows TLS1.2.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "tls_1_2_only")]
|
||||
TLS1_2Only = 504,
|
||||
|
||||
/// <summary>
|
||||
/// How to flatten the cname destination.
|
||||
/// </summary>
|
||||
[Obsolete("Please use the DNS Settings route instead.")]
|
||||
[EnumMember(Value = "cname_flattening")]
|
||||
CNAMEFlattening = 901,
|
||||
|
||||
/// <summary>
|
||||
/// Privacy Pass.
|
||||
/// </summary>
|
||||
[Obsolete("Privacy Pass v1 was deprecated in 2023.")]
|
||||
[EnumMember(Value = "privacy_pass")]
|
||||
PrivacyPass = 902,
|
||||
}
|
||||
}
|
||||
48
src/Extensions/Cloudflare.Zones/Enums/ZoneType.cs
Normal file
48
src/Extensions/Cloudflare.Zones/Enums/ZoneType.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Zone types.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/zones.ts#L223">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum ZoneType
|
||||
{
|
||||
/// <summary>
|
||||
/// Full Setup (most common).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Use Cloudflare as your primary DNS provider and manage your DNS records on Cloudflare.
|
||||
/// </remarks>
|
||||
[EnumMember(Value = "full")]
|
||||
Full = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Partial (CNAME) setup.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Keep your primary DNS provider and only use Cloudflare's reverse proxy for individual subdomains.
|
||||
/// </remarks>
|
||||
[EnumMember(Value = "partial")]
|
||||
Partial = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Zone transfers.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Use Cloudflare and another DNS provider together across your entire zone to increase availability and fault tolerance.
|
||||
/// <br/>
|
||||
/// DNS records will be transferred between providers using <see href="https://datatracker.ietf.org/doc/html/rfc5936">AXFR</see> or <see href="https://datatracker.ietf.org/doc/html/rfc1995">IXFR</see>.
|
||||
/// </remarks>
|
||||
[EnumMember(Value = "secondary")]
|
||||
Secondary = 3,
|
||||
|
||||
/// <summary>
|
||||
/// An internal zone.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "internal")]
|
||||
Internal = 4
|
||||
}
|
||||
}
|
||||
180
src/Extensions/Cloudflare.Zones/Filters/ListZonesFilter.cs
Normal file
180
src/Extensions/Cloudflare.Zones/Filters/ListZonesFilter.cs
Normal file
@@ -0,0 +1,180 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Filter for listing zones.
|
||||
/// </summary>
|
||||
public class ListZonesFilter : IQueryParameterFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// An account ID.
|
||||
/// </summary>
|
||||
public string? AccountId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An account Name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Optional filter operators can be provided to extend refine the search:
|
||||
/// <list type="bullet">
|
||||
/// <item><description>equal</description> (default)</item>
|
||||
/// <item><description>not_equal</description></item>
|
||||
/// <item><description>starts_with</description></item>
|
||||
/// <item><description>ends_with</description></item>
|
||||
/// <item><description>contains</description></item>
|
||||
/// <item><description>starts_with_case_sensitive</description></item>
|
||||
/// <item><description>ends_with_case_sensitive</description></item>
|
||||
/// <item><description>contains_case_sensitive</description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
/// <example>Dev Account</example>
|
||||
/// <example>contains:Test</example>
|
||||
public string? AccountName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Direction to order zones.
|
||||
/// </summary>
|
||||
public SortDirection? Direction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to match all search requirements or at least one (any).
|
||||
/// </summary>
|
||||
public ListZonesMatch? Match { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A domain name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Optional filter operators can be provided to extend refine the search:
|
||||
/// <list type="bullet">
|
||||
/// <item><description>equal</description> (default)</item>
|
||||
/// <item><description>not_equal</description></item>
|
||||
/// <item><description>starts_with</description></item>
|
||||
/// <item><description>ends_with</description></item>
|
||||
/// <item><description>contains</description></item>
|
||||
/// <item><description>starts_with_case_sensitive</description></item>
|
||||
/// <item><description>ends_with_case_sensitive</description></item>
|
||||
/// <item><description>contains_case_sensitive</description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
/// <example>example.com</example>
|
||||
/// <example>contains:.org</example>
|
||||
/// <example>ends_with:arpa</example>
|
||||
/// <example>starts_with:dev</example>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Field to order zones by.
|
||||
/// </summary>
|
||||
public ListZonesOrderBy? OrderBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Page number of paginated results.
|
||||
/// </summary>
|
||||
/// <value>1 <= X</value>
|
||||
public int? Page { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of zones per page.
|
||||
/// </summary>
|
||||
/// <value>5 <= X <= 50</value>
|
||||
public int? PerPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A zone status.
|
||||
/// </summary>
|
||||
public ZoneStatus? Status { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IDictionary<string, string> GetQueryParameters()
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
|
||||
#pragma warning disable CS8602, CS8604 // There will be no null value below.
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(AccountId))
|
||||
dict.Add("account.id", AccountId.Trim());
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(AccountName))
|
||||
dict.Add("account.name", AccountName.Trim());
|
||||
|
||||
if (Direction.HasValue && Enum.IsDefined(typeof(SortDirection), Direction.Value))
|
||||
dict.Add("direction", Direction.Value.GetEnumMemberValue());
|
||||
|
||||
if (Match.HasValue && Enum.IsDefined(typeof(ListZonesMatch), Match.Value))
|
||||
dict.Add("match", Match.Value.GetEnumMemberValue());
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Name))
|
||||
dict.Add("name", Name);
|
||||
|
||||
if (OrderBy.HasValue && Enum.IsDefined(typeof(ListZonesOrderBy), OrderBy.Value))
|
||||
dict.Add("order", OrderBy.Value.GetEnumMemberValue());
|
||||
|
||||
if (Page.HasValue && Page.Value >= 1)
|
||||
dict.Add("page", Page.Value.ToString());
|
||||
|
||||
if (PerPage.HasValue && PerPage.Value >= 5 && PerPage.Value <= 50)
|
||||
dict.Add("per_page", PerPage.Value.ToString());
|
||||
|
||||
if (Status.HasValue && Enum.IsDefined(typeof(ZoneStatus), Status.Value))
|
||||
dict.Add("status", Status.Value.GetEnumMemberValue());
|
||||
|
||||
#pragma warning restore CS8602, CS8604
|
||||
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Match type for listing zones.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/zones.ts#L553">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum ListZonesMatch
|
||||
{
|
||||
/// <summary>
|
||||
/// Match all search requirements.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "all")]
|
||||
All = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Match at least one search requirement.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "any")]
|
||||
Any = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Field to order zones by.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/zones.ts#L573">Source</see>
|
||||
/// </summary>
|
||||
public enum ListZonesOrderBy
|
||||
{
|
||||
/// <summary>
|
||||
/// Order by zone name.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "name")]
|
||||
Name = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Order by zone status.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "status")]
|
||||
Status = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Order by account ID.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "account.id")]
|
||||
AccountId = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Order by account name.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "account.name")]
|
||||
AccountName = 4,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones.Internals
|
||||
{
|
||||
internal class InternalCreateZoneHoldFilter : IQueryParameterFilter
|
||||
{
|
||||
public bool? IncludeSubdomains { get; set; }
|
||||
|
||||
public IDictionary<string, string> GetQueryParameters()
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
|
||||
if (IncludeSubdomains.HasValue)
|
||||
dict.Add("include_subdomains", IncludeSubdomains.Value ? "true" : "false");
|
||||
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones.Internals
|
||||
{
|
||||
internal class InternalCreateZoneRequest
|
||||
{
|
||||
public InternalCreateZoneRequest(string? accountId, string name, ZoneType? type)
|
||||
{
|
||||
Account = new Identifier { Id = accountId };
|
||||
|
||||
Name = name;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
[JsonProperty("account")]
|
||||
public Identifier Account { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public ZoneType? Type { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones.Internals
|
||||
{
|
||||
internal class InternalCreateZoneSubscriptionRequest
|
||||
{
|
||||
[JsonProperty("frequency")]
|
||||
public RenewFrequency? Frequency { get; set; }
|
||||
|
||||
[JsonProperty("rate_plan")]
|
||||
public RatePlan? RatePlan { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones.Internals
|
||||
{
|
||||
internal class InternalEditZoneRequest
|
||||
{
|
||||
[JsonProperty("paused")]
|
||||
public bool? Paused { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public ZoneType? Type { get; set; }
|
||||
|
||||
[JsonProperty("vanity_name_servers")]
|
||||
public IReadOnlyCollection<string>? VanityNameServers { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones.Internals
|
||||
{
|
||||
internal class InternalRemoveZoneHoldFilter : IQueryParameterFilter
|
||||
{
|
||||
public DateTime? HoldAfter { get; set; }
|
||||
|
||||
public IDictionary<string, string> GetQueryParameters()
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
|
||||
if (HoldAfter.HasValue)
|
||||
dict.Add("hold_after", HoldAfter.Value.ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:ss'Z'"));
|
||||
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones.Internals
|
||||
{
|
||||
internal class InternalUpdateDomainRequest
|
||||
{
|
||||
[JsonProperty("auto_renew")]
|
||||
public bool? AutoRenew { get; set; }
|
||||
|
||||
[JsonProperty("locked")]
|
||||
public bool? Locked { get; set; }
|
||||
|
||||
[JsonProperty("privacy")]
|
||||
public bool? Privacy { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones.Internals
|
||||
{
|
||||
internal class InternalUpdateZoneHoldRequest
|
||||
{
|
||||
[JsonProperty("hold_after")]
|
||||
public DateTime? HoldAfter { get; set; }
|
||||
|
||||
[JsonProperty("include_subdomains")]
|
||||
public bool? IncludeSubdomains { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones.Internals
|
||||
{
|
||||
internal class InternalUpdateZoneSubscriptionRequest
|
||||
{
|
||||
[JsonProperty("frequency")]
|
||||
public RenewFrequency? Frequency { get; set; }
|
||||
|
||||
[JsonProperty("rate_plan")]
|
||||
public RatePlan? RatePlan { get; set; }
|
||||
}
|
||||
}
|
||||
69
src/Extensions/Cloudflare.Zones/Models/AvailableRatePlan.cs
Normal file
69
src/Extensions/Cloudflare.Zones/Models/AvailableRatePlan.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// A Cloudflare available plan.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/plans.ts#L60">Source</see>
|
||||
/// </summary>
|
||||
public class AvailableRatePlan
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifier.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether you can subscribe to this plan.
|
||||
/// </summary>
|
||||
[JsonProperty("can_subscribe")]
|
||||
public bool? CanSubscribe { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The monetary unit in which pricing information is displayed.
|
||||
/// </summary>
|
||||
[JsonProperty("currency")]
|
||||
public string? Currency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether this plan is managed externally.
|
||||
/// </summary>
|
||||
[JsonProperty("externally_managed")]
|
||||
public bool? ExternallyManaged { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The frequency at which you will be billed for this plan.
|
||||
/// </summary>
|
||||
[JsonProperty("frequency")]
|
||||
public RenewFrequency? Frequency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether you are currently subscribed to this plan.
|
||||
/// </summary>
|
||||
[JsonProperty("is_subscribed")]
|
||||
public bool? IsSubscribed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether this plan has a legacy discount applied.
|
||||
/// </summary>
|
||||
[JsonProperty("legacy_discount")]
|
||||
public bool? LegacyDiscount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The legacy identifier for this rate plan, if any.
|
||||
/// </summary>
|
||||
[JsonProperty("legacy_id")]
|
||||
public string? LegacyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The plan name.
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount you will be billed for this plan.
|
||||
/// </summary>
|
||||
[JsonProperty("price")]
|
||||
public decimal? Price { get; set; }
|
||||
}
|
||||
}
|
||||
394
src/Extensions/Cloudflare.Zones/Models/Domain.cs
Normal file
394
src/Extensions/Cloudflare.Zones/Models/Domain.cs
Normal file
@@ -0,0 +1,394 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// A Cloudflare registrar domain.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/registrar/domains.ts#L79">Source</see>
|
||||
/// </summary>
|
||||
public class Domain
|
||||
{
|
||||
/// <summary>
|
||||
/// Domain identifier.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Shows if a domain is available for transferring into Cloudflare Registrar.
|
||||
/// </summary>
|
||||
[JsonProperty("available")]
|
||||
public bool? Available { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the domain can be registered as a new domain.
|
||||
/// </summary>
|
||||
[JsonProperty("can_register")]
|
||||
public bool? CanRegister { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Shows time of creation.
|
||||
/// </summary>
|
||||
[JsonProperty("created_at")]
|
||||
public DateTime? CreatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Shows name of current registrar.
|
||||
/// </summary>
|
||||
[JsonProperty("current_registrar")]
|
||||
public string? CurrentRegistrar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Shows when domain name registration expires.
|
||||
/// </summary>
|
||||
[JsonProperty("expires_at")]
|
||||
public DateTime? ExpiresAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Shows whether a registrar lock is in place for a domain.
|
||||
/// </summary>
|
||||
[JsonProperty("locked")]
|
||||
public bool? Locked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Shows contact information for domain registrant.
|
||||
/// </summary>
|
||||
[JsonProperty("registrant_contact")]
|
||||
public DomainRegistrantContact? RegistrantContact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A comma-separated list of registry status codes.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A full list of status codes can be found at <see href="https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en">EPP Status Codes</see>.
|
||||
/// </remarks>
|
||||
[JsonProperty("registry_statuses")]
|
||||
public string? RegistryStatuses { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether a particular TLD is currently supported by Cloudflare Registrar.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Refer to <see href="https://www.cloudflare.com/tld-policies/">TLD Policies</see> for a list of supported TLDs.
|
||||
/// </remarks>
|
||||
[JsonProperty("supported_tld")]
|
||||
public bool? SupportedTld { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Statuses for domain transfers into Cloudflare Registrar.
|
||||
/// </summary>
|
||||
[JsonProperty("transfer_in")]
|
||||
public DomainTransferIn? TransferIn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last updated.
|
||||
/// </summary>
|
||||
[JsonProperty("updated_at")]
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows contact information for domain registrant.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/registrar/domains.ts#L149">Source</see>
|
||||
/// </summary>
|
||||
public class DomainRegistrantContact
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DomainRegistrantContact"/> class.
|
||||
/// </summary>
|
||||
/// <param name="address">Address.</param>
|
||||
/// <param name="city">City.</param>
|
||||
/// <param name="state">State.</param>
|
||||
/// <param name="organization">User's organization.</param>
|
||||
public DomainRegistrantContact(string address, string city, string state, string organization)
|
||||
{
|
||||
Address = address;
|
||||
City = city;
|
||||
State = state;
|
||||
Organization = organization;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Address.
|
||||
/// </summary>
|
||||
[JsonProperty("address")]
|
||||
public string Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// City.
|
||||
/// </summary>
|
||||
[JsonProperty("city")]
|
||||
public string City { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The country in which the user lives..
|
||||
/// </summary>
|
||||
[JsonProperty("country")]
|
||||
public string? Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's first name.
|
||||
/// </summary>
|
||||
[JsonProperty("first_name")]
|
||||
public string? FirstName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's last name.
|
||||
/// </summary>
|
||||
[JsonProperty("last_name")]
|
||||
public string? LastName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of organization.
|
||||
/// </summary>
|
||||
[JsonProperty("organization")]
|
||||
public string Organization { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's telephone number.
|
||||
/// </summary>
|
||||
[JsonProperty("phone")]
|
||||
public string? Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// State.
|
||||
/// </summary>
|
||||
[JsonProperty("state")]
|
||||
public string State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The zipcode or postal code where the user lives.
|
||||
/// </summary>
|
||||
[JsonProperty("zip")]
|
||||
public string? ZipCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Contact Identifier.
|
||||
/// </summary>
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional address line for unit, floor, suite, etc.
|
||||
/// </summary>
|
||||
[JsonProperty("address2")]
|
||||
public string? Address2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The contact email address of the user.
|
||||
/// </summary>
|
||||
[JsonProperty("email")]
|
||||
public string? Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Contact fax number.
|
||||
/// </summary>
|
||||
[JsonProperty("fax")]
|
||||
public string? Fax { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Statuses for domain transfers into Cloudflare Registrar.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/registrar/domains.ts#L219">Source</see>
|
||||
/// </summary>
|
||||
public class DomainTransferIn
|
||||
{
|
||||
/// <summary>
|
||||
/// Form of authorization has been accepted by the registrant.
|
||||
/// </summary>
|
||||
[JsonProperty("accept_foa")]
|
||||
public DomainTransferInAcceptFoa? AcceptFoa { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Shows transfer status with the registry.
|
||||
/// </summary>
|
||||
[JsonProperty("approve_transfer")]
|
||||
public DomainTransferInApproveTransfer? ApproveTransfer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if cancellation is still possible.
|
||||
/// </summary>
|
||||
[JsonProperty("can_cancel_transfer")]
|
||||
public bool? CanCancelTransfer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Privacy guards are disabled at the foreign registrar.
|
||||
/// </summary>
|
||||
[JsonProperty("disable_privacy")]
|
||||
public DomainTransferInDisablePrivacy? DisablePrivacy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Auth code has been entered and verified.
|
||||
/// </summary>
|
||||
[JsonProperty("enter_auth_code")]
|
||||
public DomainTransferInEnterAuthCode? EnterAuthCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Domain is unlocked at the foreign registrar.
|
||||
/// </summary>
|
||||
[JsonProperty("unlock_domain")]
|
||||
public DomainTransferInUnlockDomain? UnlockDomain { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/registrar/domains.ts#L223">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum DomainTransferInAcceptFoa
|
||||
{
|
||||
/// <summary>
|
||||
/// Needed.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "needed")]
|
||||
Needed = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Ok.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ok")]
|
||||
Ok = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/registrar/domains.ts#L228">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum DomainTransferInApproveTransfer
|
||||
{
|
||||
/// <summary>
|
||||
/// Needed.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "needed")]
|
||||
Needed = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Ok.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ok")]
|
||||
Ok = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Pending.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "pending")]
|
||||
Pending = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Trying.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "trying")]
|
||||
Trying = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Rejected.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "rejected")]
|
||||
Rejected = 5,
|
||||
|
||||
/// <summary>
|
||||
/// Unknown.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "unknown")]
|
||||
Unknown = 6
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/registrar/domains.ts#L238">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum DomainTransferInDisablePrivacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Needed.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "needed")]
|
||||
Needed = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Ok.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ok")]
|
||||
Ok = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Unknown.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "unknown")]
|
||||
Unknown = 3
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/registrar/domains.ts#L243">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum DomainTransferInEnterAuthCode
|
||||
{
|
||||
/// <summary>
|
||||
/// Needed.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "needed")]
|
||||
Needed = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Ok.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ok")]
|
||||
Ok = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Pending.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "pending")]
|
||||
Pending = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Trying.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "trying")]
|
||||
Trying = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Rejected.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "rejected")]
|
||||
Rejected = 5
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/registrar/domains.ts#L248">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum DomainTransferInUnlockDomain
|
||||
{
|
||||
/// <summary>
|
||||
/// Needed.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "needed")]
|
||||
Needed = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Ok.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "ok")]
|
||||
Ok = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Pending.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "pending")]
|
||||
Pending = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Trying.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "trying")]
|
||||
Trying = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Unknown.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "unknown")]
|
||||
Unknown = 5
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Advanced protection from Distributed Denial of Service (DDoS) attacks on your
|
||||
/// website. This is an uneditable value that is <see cref="OnOffState.On"/> in the
|
||||
/// case of Business and Enterprise zones.
|
||||
/// </summary>
|
||||
public class AdvancedDDoS : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AdvancedDDoS"/> class.
|
||||
/// </summary>
|
||||
public AdvancedDDoS()
|
||||
{
|
||||
Id = ZoneSettingId.AdvancedDDoS;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
44
src/Extensions/Cloudflare.Zones/Models/Settings/Aegis.cs
Normal file
44
src/Extensions/Cloudflare.Zones/Models/Settings/Aegis.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Aegis provides dedicated egress IPs (from Cloudflare to your origin) for your
|
||||
/// layer 7 WAF and CDN services. The egress IPs are reserved exclusively for your
|
||||
/// account so that you can increase your origin security by only allowing traffic
|
||||
/// from a small list of IP addresses.
|
||||
/// </summary>
|
||||
public class Aegis : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Aegis"/> class.
|
||||
/// </summary>
|
||||
public Aegis()
|
||||
{
|
||||
Id = ZoneSettingId.Aegis;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public AegisValue? Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value of the zone setting.
|
||||
/// </summary>
|
||||
public class AegisValue
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the feature is enabled or not.
|
||||
/// </summary>
|
||||
[JsonProperty("enabled")]
|
||||
public bool? Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Egress pool id which refers to a grouping of dedicated egress IPs through which
|
||||
/// Cloudflare will connect to origin.
|
||||
/// </summary>
|
||||
[JsonProperty("pool_id")]
|
||||
public string? PoolId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// When enabled, Cloudflare serves limited copies of web pages available from the
|
||||
/// <see href="https://archive.org/web/">Internet Archive's Wayback Machine</see>
|
||||
/// if your server is offline.
|
||||
/// Refer to <see href="https://developers.cloudflare.com/cache/about/always-online">Always Online</see>
|
||||
/// for more information.
|
||||
/// </summary>
|
||||
public class AlwaysOnline : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AlwaysOnline"/> class.
|
||||
/// </summary>
|
||||
public AlwaysOnline()
|
||||
{
|
||||
Id = ZoneSettingId.AlwaysOnline;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// If enabled, any <c>http://</c> URL is converted to <c>https://</c> through a 301
|
||||
/// redirect.
|
||||
/// </summary>
|
||||
public class AlwaysUseHTTPS : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AlwaysUseHTTPS"/> class.
|
||||
/// </summary>
|
||||
public AlwaysUseHTTPS()
|
||||
{
|
||||
Id = ZoneSettingId.AlwaysUseHTTPS;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Turn on or off Automatic HTTPS Rewrites.
|
||||
/// </summary>
|
||||
public class AutomaticHTTPSRewrites : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AutomaticHTTPSRewrites"/> class.
|
||||
/// </summary>
|
||||
public AutomaticHTTPSRewrites()
|
||||
{
|
||||
Id = ZoneSettingId.AutomaticHTTPSRewrites;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Apply custom caching based on the option selected.
|
||||
/// </summary>
|
||||
public class AutomaticPlatformOptimization
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether or not
|
||||
/// <see href="https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/">cache by device type</see>
|
||||
/// is enabled.
|
||||
/// </summary>
|
||||
[JsonProperty("cache_by_device_type")]
|
||||
public bool? CacheByDeviceType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether or not Cloudflare proxy is enabled.
|
||||
/// </summary>
|
||||
[JsonProperty("cf")]
|
||||
public bool? CloudflareProxyEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether or not Automatic Platform Optimization is enabled.
|
||||
/// </summary>
|
||||
[JsonProperty("enabled")]
|
||||
public bool? Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An array of hostnames where Automatic Platform Optimization for WordPress is activated.
|
||||
/// </summary>
|
||||
[JsonProperty("hostnames")]
|
||||
public IReadOnlyCollection<string>? Hostnames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether or not site is powered by WordPress.
|
||||
/// </summary>
|
||||
[JsonProperty("wordpress")]
|
||||
public bool? WordPress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether or not
|
||||
/// <see href="https://wordpress.org/plugins/cloudflare/">Cloudflare for WordPress plugin</see>
|
||||
/// is installed.
|
||||
/// </summary>
|
||||
[JsonProperty("wp_plugin")]
|
||||
public bool? WpPlugin { get; set; }
|
||||
}
|
||||
}
|
||||
23
src/Extensions/Cloudflare.Zones/Models/Settings/Brotli.cs
Normal file
23
src/Extensions/Cloudflare.Zones/Models/Settings/Brotli.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// When the client requesting an asset supports the Brotli compression algorithm,
|
||||
/// Cloudflare will serve a Brotli compressed version of the asset.
|
||||
/// </summary>
|
||||
public class Brotli : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Brotli"/> class.
|
||||
/// </summary>
|
||||
public Brotli()
|
||||
{
|
||||
Id = ZoneSettingId.Brotli;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Control how long resources cached by client browsers remain valid.
|
||||
/// </summary>
|
||||
public class BrowserCacheTTL : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BrowserCacheTTL"/> class.
|
||||
/// </summary>
|
||||
public BrowserCacheTTL()
|
||||
{
|
||||
Id = ZoneSettingId.BrowserCacheTTL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The number of seconds to cache resources for.
|
||||
/// The API prohibits setting this to 0 for non-Enterprise domains.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public int? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Inspect the visitor's browser for headers commonly associated with spammers and
|
||||
/// certain bots.
|
||||
/// </summary>
|
||||
public class BrowserCheck : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BrowserCheck"/> class.
|
||||
/// </summary>
|
||||
public BrowserCheck()
|
||||
{
|
||||
Id = ZoneSettingId.BrowserCheck;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The status of Browser Integrity Check.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// How to flatten the cname destination.
|
||||
/// </summary>
|
||||
[Obsolete("Please use the DNS Settings route instead.")]
|
||||
public class CNAMEFlattening : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CNAMEFlattening"/> class.
|
||||
/// </summary>
|
||||
public CNAMEFlattening()
|
||||
{
|
||||
Id = ZoneSettingId.CNAMEFlattening;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[Obsolete("Please use the DNS Settings route instead.")]
|
||||
[JsonProperty("value")]
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Apply custom caching based on the option selected.
|
||||
/// </summary>
|
||||
public class CacheLevel : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CacheLevel"/> class.
|
||||
/// </summary>
|
||||
public CacheLevel()
|
||||
{
|
||||
Id = ZoneSettingId.CacheLevel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public CacheLevelOption? Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply custom caching based on the option selected.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L365">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum CacheLevelOption
|
||||
{
|
||||
/// <summary>
|
||||
/// Cloudflare does not cache.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "bypass")]
|
||||
Bypass = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Delivers resources from cache when there is no query string.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "basic")]
|
||||
Basic = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Delivers the same resource to everyone independent of the query string.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "simplified")]
|
||||
Simplified = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Caches all static content that has a query string.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "aggressive")]
|
||||
Aggressive = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Treats all content as static and caches all file types beyond the
|
||||
/// <see href="https://developers.cloudflare.com/cache/concepts/default-cache-behavior/#default-cached-file-extensions">Cloudflare default cached content</see>
|
||||
/// </summary>
|
||||
[EnumMember(Value = "cache_everything")]
|
||||
CacheEverything = 5
|
||||
}
|
||||
}
|
||||
103
src/Extensions/Cloudflare.Zones/Models/Settings/ChallengeTTL.cs
Normal file
103
src/Extensions/Cloudflare.Zones/Models/Settings/ChallengeTTL.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Specify how long a visitor is allowed access to your site after successfully
|
||||
/// completing a challenge (such as a CAPTCHA). After the TTL has expired the
|
||||
/// visitor will have to complete a new challenge. We recommend a 15 - 45 minute
|
||||
/// setting and will attempt to honor any setting above 45 minutes.
|
||||
/// (<see href="https://support.cloudflare.com/hc/en-us/articles/200170136"/>).
|
||||
/// </summary>
|
||||
public class ChallengeTTL : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChallengeTTL"/> class.
|
||||
/// </summary>
|
||||
public ChallengeTTL()
|
||||
{
|
||||
Id = ZoneSettingId.ChallengeTTL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public ChallengeTTLValue Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The time-to-live (TTL) of the challenge.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L403">Soruce</see>
|
||||
/// </summary>
|
||||
public enum ChallengeTTLValue : int
|
||||
{
|
||||
/// <summary>
|
||||
/// 5 minutes.
|
||||
/// </summary>
|
||||
FiveMinutes = 300,
|
||||
|
||||
/// <summary>
|
||||
/// 15 minutes.
|
||||
/// </summary>
|
||||
FifteenMinutes = 900,
|
||||
|
||||
/// <summary>
|
||||
/// 30 minutes.
|
||||
/// </summary>
|
||||
HalfHour = 1800,
|
||||
|
||||
/// <summary>
|
||||
/// 45 minutes.
|
||||
/// </summary>
|
||||
ThreeQuartersHour = 2700,
|
||||
|
||||
/// <summary>
|
||||
/// 1 hour.
|
||||
/// </summary>
|
||||
Hour = 3600,
|
||||
|
||||
/// <summary>
|
||||
/// 2 hours.
|
||||
/// </summary>
|
||||
TwoHours = 7200,
|
||||
|
||||
/// <summary>
|
||||
/// 3 hours.
|
||||
/// </summary>
|
||||
ThreeHours = 10800,
|
||||
|
||||
/// <summary>
|
||||
/// 4 hours.
|
||||
/// </summary>
|
||||
FourHours = 14400,
|
||||
|
||||
/// <summary>
|
||||
/// 8 hours.
|
||||
/// </summary>
|
||||
EightHours = 28800,
|
||||
|
||||
/// <summary>
|
||||
/// 16 hours.
|
||||
/// </summary>
|
||||
SixteenHours = 57600,
|
||||
|
||||
/// <summary>
|
||||
/// 1 day.
|
||||
/// </summary>
|
||||
Day = 86400,
|
||||
|
||||
/// <summary>
|
||||
/// 1 week.
|
||||
/// </summary>
|
||||
Week = 604800,
|
||||
|
||||
/// <summary>
|
||||
/// 30 days.
|
||||
/// </summary>
|
||||
Month = 2592000,
|
||||
|
||||
/// <summary>
|
||||
/// 365 days.
|
||||
/// </summary>
|
||||
Year = 31536000
|
||||
}
|
||||
}
|
||||
23
src/Extensions/Cloudflare.Zones/Models/Settings/Ciphers.cs
Normal file
23
src/Extensions/Cloudflare.Zones/Models/Settings/Ciphers.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// An allowlist of ciphers for TLS termination. These ciphers must be in the
|
||||
/// BoringSSL format.
|
||||
/// </summary>
|
||||
public class Ciphers : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Ciphers"/> class.
|
||||
/// </summary>
|
||||
public Ciphers()
|
||||
{
|
||||
Id = ZoneSettingId.Ciphers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public IReadOnlyCollection<string> Value { get; set; } = [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Development Mode temporarily allows you to enter development mode for your
|
||||
/// websites if you need to make changes to your site.This will bypass Cloudflare's
|
||||
/// accelerated cache and slow down your site, but is useful if you are making
|
||||
/// changes to cacheable content (like images, css, or JavaScript) and would like to
|
||||
/// see those changes right away. Once entered, development mode will last for 3
|
||||
/// hours and then automatically toggle off.
|
||||
/// </summary>
|
||||
public class DevelopmentMode : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DevelopmentMode"/> class.
|
||||
/// </summary>
|
||||
public DevelopmentMode()
|
||||
{
|
||||
Id = ZoneSettingId.DevelopmentMode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current state of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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 zero.
|
||||
/// </summary>
|
||||
[JsonProperty("time_remaining")]
|
||||
public int? TimeRemaining { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// When enabled, Cloudflare will attempt to speed up overall page loads by serving
|
||||
/// <c>103</c> responses with <c>Link</c> headers from the final response. Refer to
|
||||
/// <see href="https://developers.cloudflare.com/cache/about/early-hints">Early Hints</see>
|
||||
/// for more information.
|
||||
/// </summary>
|
||||
public class EarlyHints : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EarlyHints"/> class.
|
||||
/// </summary>
|
||||
public EarlyHints()
|
||||
{
|
||||
Id = ZoneSettingId.EarlyHints;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Turn on or off <strong>Email Obfuscation</strong>.
|
||||
/// </summary>
|
||||
public class EmailObfuscation : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EmailObfuscation"/> class.
|
||||
/// </summary>
|
||||
public EmailObfuscation()
|
||||
{
|
||||
Id = ZoneSettingId.EmailObfuscation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Enhance your website's font delivery with Cloudflare Fonts. Deliver Google
|
||||
/// Hosted fonts from your own domain, boost performance, and enhance user privacy.
|
||||
/// Refer to the Cloudflare Fonts documentation for more information.
|
||||
/// </summary>
|
||||
public class FontSettings : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FontSettings"/> class.
|
||||
/// </summary>
|
||||
public FontSettings()
|
||||
{
|
||||
Id = ZoneSettingId.FontSettings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// HTTP/2 Edge Prioritization optimises the delivery of resources served through
|
||||
/// HTTP/2 to improve page load performance.It also supports fine control of
|
||||
/// content delivery when used in conjunction with Workers.
|
||||
/// </summary>
|
||||
public class H2Prioritization : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="H2Prioritization"/> class.
|
||||
/// </summary>
|
||||
public H2Prioritization()
|
||||
{
|
||||
Id = ZoneSettingId.H2Prioritization;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffCustomState Value { get; set; }
|
||||
}
|
||||
}
|
||||
22
src/Extensions/Cloudflare.Zones/Models/Settings/HTTP2.cs
Normal file
22
src/Extensions/Cloudflare.Zones/Models/Settings/HTTP2.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// HTTP/2 enabled for this zone.
|
||||
/// </summary>
|
||||
public class HTTP2 : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HTTP2"/> class.
|
||||
/// </summary>
|
||||
public HTTP2()
|
||||
{
|
||||
Id = ZoneSettingId.HTTP2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
22
src/Extensions/Cloudflare.Zones/Models/Settings/HTTP3.cs
Normal file
22
src/Extensions/Cloudflare.Zones/Models/Settings/HTTP3.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// HTTP/3 enabled for this zone.
|
||||
/// </summary>
|
||||
public class HTTP3 : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HTTP3"/> class.
|
||||
/// </summary>
|
||||
public HTTP3()
|
||||
{
|
||||
Id = ZoneSettingId.HTTP3;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// When enabled, the Hotlink Protection option ensures that other sites cannot suck
|
||||
/// up your bandwidth by building pages that use images hosted on your site.Anytime
|
||||
/// a request for an image on your site hits Cloudflare, we check to ensure that
|
||||
/// it's not another site requesting them. People will still be able to download and
|
||||
/// view images from your page, but other sites won't be able to steal them for use
|
||||
/// on their own pages.
|
||||
/// (<see href="https://support.cloudflare.com/hc/en-us/articles/200170026"/>).
|
||||
/// </summary>
|
||||
public class HotlinkProtection : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HotlinkProtection"/> class.
|
||||
/// </summary>
|
||||
public HotlinkProtection()
|
||||
{
|
||||
Id = ZoneSettingId.HotlinkProtection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Cloudflare adds a CF-IPCountry HTTP header containing the country code that
|
||||
/// corresponds to the visitor.
|
||||
/// </summary>
|
||||
public class IPGeolocation : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IPGeolocation"/> class.
|
||||
/// </summary>
|
||||
public IPGeolocation()
|
||||
{
|
||||
Id = ZoneSettingId.IPGeolocation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The status of adding the IP Geolocation Header.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
23
src/Extensions/Cloudflare.Zones/Models/Settings/IPV6.cs
Normal file
23
src/Extensions/Cloudflare.Zones/Models/Settings/IPV6.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Enable IPv6 on all subdomains that are Cloudflare enabled.
|
||||
/// (<see href="https://support.cloudflare.com/hc/en-us/articles/200168586"/>).
|
||||
/// </summary>
|
||||
public class IPV6 : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IPV6"/> class.
|
||||
/// </summary>
|
||||
public IPV6()
|
||||
{
|
||||
Id = ZoneSettingId.IPV6;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Image Transformations provides on-demand resizing, conversion and optimization
|
||||
/// for images served through Cloudflare's network. Refer to the
|
||||
/// <see href="https://developers.cloudflare.com/images/">Image Transformations documentation</see>
|
||||
/// for more information.
|
||||
/// </summary>
|
||||
public class ImageResizing : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ImageResizing"/> class.
|
||||
/// </summary>
|
||||
public ImageResizing()
|
||||
{
|
||||
Id = ZoneSettingId.ImageResizing;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffOpenState Value { get; set; }
|
||||
}
|
||||
}
|
||||
119
src/Extensions/Cloudflare.Zones/Models/Settings/MaxUpload.cs
Normal file
119
src/Extensions/Cloudflare.Zones/Models/Settings/MaxUpload.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Maximum size of an allowable upload.
|
||||
/// </summary>
|
||||
public class MaxUpload : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialize a new instance of the <see cref="MaxUpload"/> class.
|
||||
/// </summary>
|
||||
public MaxUpload()
|
||||
{
|
||||
Id = ZoneSettingId.MaxUpload;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public MaxUploadSize Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maximum size of an allowable upload.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L1980">Soruce</see>
|
||||
/// </summary>
|
||||
public enum MaxUploadSize : int
|
||||
{
|
||||
/// <summary>
|
||||
/// 100 MB.
|
||||
/// </summary>
|
||||
M100 = 100,
|
||||
|
||||
/// <summary>
|
||||
/// 125 MB.
|
||||
/// </summary>
|
||||
M125 = 125,
|
||||
|
||||
/// <summary>
|
||||
/// 150 MB.
|
||||
/// </summary>
|
||||
M150 = 150,
|
||||
|
||||
/// <summary>
|
||||
/// 175 MB.
|
||||
/// </summary>
|
||||
M175 = 175,
|
||||
|
||||
/// <summary>
|
||||
/// 200 MB.
|
||||
/// </summary>
|
||||
M200 = 200,
|
||||
|
||||
/// <summary>
|
||||
/// 225 MB.
|
||||
/// </summary>
|
||||
M225 = 225,
|
||||
|
||||
/// <summary>
|
||||
/// 250 MB.
|
||||
/// </summary>
|
||||
M250 = 250,
|
||||
|
||||
/// <summary>
|
||||
/// 275 MB.
|
||||
/// </summary>
|
||||
M275 = 275,
|
||||
|
||||
/// <summary>
|
||||
/// 300 MB.
|
||||
/// </summary>
|
||||
M300 = 300,
|
||||
|
||||
/// <summary>
|
||||
/// 325 MB.
|
||||
/// </summary>
|
||||
M325 = 325,
|
||||
|
||||
/// <summary>
|
||||
/// 350 MB.
|
||||
/// </summary>
|
||||
M350 = 350,
|
||||
|
||||
/// <summary>
|
||||
/// 375 MB.
|
||||
/// </summary>
|
||||
M375 = 375,
|
||||
|
||||
/// <summary>
|
||||
/// 400 MB.
|
||||
/// </summary>
|
||||
M400 = 400,
|
||||
|
||||
/// <summary>
|
||||
/// 425 MB.
|
||||
/// </summary>
|
||||
M425 = 425,
|
||||
|
||||
/// <summary>
|
||||
/// 450 MB.
|
||||
/// </summary>
|
||||
M450 = 450,
|
||||
|
||||
/// <summary>
|
||||
/// 475 MB.
|
||||
/// </summary>
|
||||
M475 = 475,
|
||||
|
||||
/// <summary>
|
||||
/// 500 MB.
|
||||
/// </summary>
|
||||
M500 = 500,
|
||||
|
||||
/// <summary>
|
||||
/// 1000 MB (1 GB).
|
||||
/// </summary>
|
||||
G1 = 1000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Only accepts HTTPS requests that use at least the TLS protocol version
|
||||
/// specified. For example, if TLS 1.1 is selected, TLS 1.0 connections will be
|
||||
/// rejected, while 1.1, 1.2, and 1.3 (if enabled) will be permitted.
|
||||
/// </summary>
|
||||
public class MinTLSVersion : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MinTLSVersion"/> class.
|
||||
/// </summary>
|
||||
public MinTLSVersion()
|
||||
{
|
||||
Id = ZoneSettingId.MinTLSVersion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
public TlsVersion? Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Available TLS versions.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L785">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum TlsVersion
|
||||
{
|
||||
/// <summary>
|
||||
/// TLS 1.0
|
||||
/// </summary>
|
||||
[EnumMember(Value = "1.0")]
|
||||
Tls10 = 1,
|
||||
|
||||
/// <summary>
|
||||
/// TLS 1.1
|
||||
/// </summary>
|
||||
[EnumMember(Value = "1.1")]
|
||||
Tls11 = 2,
|
||||
|
||||
/// <summary>
|
||||
/// TLS 1.2
|
||||
/// </summary>
|
||||
[EnumMember(Value = "1.2")]
|
||||
Tls12 = 3,
|
||||
|
||||
/// <summary>
|
||||
/// TLS 1.3
|
||||
/// </summary>
|
||||
[EnumMember(Value = "1.3")]
|
||||
Tls13 = 4
|
||||
}
|
||||
}
|
||||
24
src/Extensions/Cloudflare.Zones/Models/Settings/Mirage.cs
Normal file
24
src/Extensions/Cloudflare.Zones/Models/Settings/Mirage.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Cloudflare Mirage reduces bandwidth used by images in mobile browsers. It can
|
||||
/// accelerate loading of image-heavy websites on very slow mobile connections and
|
||||
/// HTTP/1.
|
||||
/// </summary>
|
||||
public class Mirage : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mirage"/> class.
|
||||
/// </summary>
|
||||
public Mirage()
|
||||
{
|
||||
Id = ZoneSettingId.Mirage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The status of Mirage.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
34
src/Extensions/Cloudflare.Zones/Models/Settings/NEL.cs
Normal file
34
src/Extensions/Cloudflare.Zones/Models/Settings/NEL.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Enable Network Error Logging reporting on your zone. (Beta)
|
||||
/// </summary>
|
||||
public class NEL : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NEL"/> class.
|
||||
/// </summary>
|
||||
public NEL()
|
||||
{
|
||||
Id = ZoneSettingId.NEL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public NELValue? Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
public class NELValue
|
||||
{
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("enabled")]
|
||||
public bool? Enabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Opportunistic Encryption allows browsers to access HTTP URIs over an encrypted
|
||||
/// TLS channel. It's not a substitute for HTTPS, but provides additional security
|
||||
/// for otherwise vulnerable requests.
|
||||
/// </summary>
|
||||
public class OpportunisticEncryption : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OpportunisticEncryption"/> class.
|
||||
/// </summary>
|
||||
public OpportunisticEncryption()
|
||||
{
|
||||
Id = ZoneSettingId.OpportunisticEncryption;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The status of Opportunistic Encryption.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Add an Alt-Svc header to all legitimate requests from Tor, allowing the
|
||||
/// connection to use our onion services instead of exit nodes.
|
||||
/// </summary>
|
||||
public class OpportunisticOnion : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OpportunisticOnion"/> class.
|
||||
/// </summary>
|
||||
public OpportunisticOnion()
|
||||
{
|
||||
Id = ZoneSettingId.OpportunisticOnion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also
|
||||
/// on Cloudflare.
|
||||
/// </summary>
|
||||
public class OrangeToOrange : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OrangeToOrange"/> class.
|
||||
/// </summary>
|
||||
public OrangeToOrange()
|
||||
{
|
||||
Id = ZoneSettingId.OrangeToOrange;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Turn on or off Cloudflare error pages generated from issues sent from the origin
|
||||
/// server. If enabled, this setting triggers error pages issued by the origin.
|
||||
/// </summary>
|
||||
public class OriginErrorPagePassThru : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OriginErrorPagePassThru"/> class.
|
||||
/// </summary>
|
||||
public OriginErrorPagePassThru()
|
||||
{
|
||||
Id = ZoneSettingId.OriginErrorPagePassThru;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The status of Origin Error Page Passthru.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum HTTP version supported by the origin server.
|
||||
/// </summary>
|
||||
public class OriginMaxHTTPVersion : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OriginMaxHTTPVersion"/> class.
|
||||
/// </summary>
|
||||
public OriginMaxHTTPVersion()
|
||||
{
|
||||
Id = ZoneSettingId.OriginMaxHTTPVersion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The value of the feature.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public HttpVersion Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HTTP versions.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L984">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum HttpVersion
|
||||
{
|
||||
/// <summary>
|
||||
/// HTTP/1
|
||||
/// </summary>
|
||||
[EnumMember(Value = "1")]
|
||||
HTTP1 = 1,
|
||||
|
||||
/// <summary>
|
||||
/// HTTP/2
|
||||
/// </summary>
|
||||
[EnumMember(Value = "2")]
|
||||
HTTP2 = 2
|
||||
}
|
||||
}
|
||||
51
src/Extensions/Cloudflare.Zones/Models/Settings/Polish.cs
Normal file
51
src/Extensions/Cloudflare.Zones/Models/Settings/Polish.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Apply options from the Polish feature of the Cloudflare Speed app.
|
||||
/// </summary>
|
||||
public class Polish : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Polish"/> class.
|
||||
/// </summary>
|
||||
public Polish()
|
||||
{
|
||||
Id = ZoneSettingId.Polish;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The level of Polish you want applied to your origin.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public PolishLevel? Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The level of Polish.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L1001">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum PolishLevel
|
||||
{
|
||||
/// <summary>
|
||||
/// No Polish.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "off")]
|
||||
Off = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Basic Polish.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "lossless")]
|
||||
LossLess = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Full Polish.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "lossy")]
|
||||
Lossy = 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Cloudflare will prefetch any URLs that are included in the response headers.
|
||||
/// This is limited to Enterprise Zones.
|
||||
/// </summary>
|
||||
public class PrefetchPreload : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PrefetchPreload"/> class.
|
||||
/// </summary>
|
||||
public PrefetchPreload()
|
||||
{
|
||||
Id = ZoneSettingId.PrefetchPreload;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Privacy Pass.
|
||||
/// </summary>
|
||||
[Obsolete("Privacy Pass v1 was deprecated in 2023.")]
|
||||
public class PrivacyPass : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PrivacyPass"/> class.
|
||||
/// </summary>
|
||||
public PrivacyPass()
|
||||
{
|
||||
Id = ZoneSettingId.PrivacyPass;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Maximum time between two read operations from origin.
|
||||
/// </summary>
|
||||
public class ProxyReadTimeout : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ProxyReadTimeout"/> class.
|
||||
/// </summary>
|
||||
public ProxyReadTimeout()
|
||||
{
|
||||
Id = ZoneSettingId.ProxyReadTimeout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public int Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// The value set for the Pseudo IPv4 setting.
|
||||
/// </summary>
|
||||
public class PseudoIPV4 : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PseudoIPV4"/> class.
|
||||
/// </summary>
|
||||
public PseudoIPV4()
|
||||
{
|
||||
Id = ZoneSettingId.PseudoIPV4;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public PseudoIPV4Value Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pseudo IPv4 values.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L1081">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum PseudoIPV4Value
|
||||
{
|
||||
/// <summary>
|
||||
/// Off.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "off")]
|
||||
Off = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Add a header.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "add_header")]
|
||||
AddHeader = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Add header or overwrite if exists.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "overwrite_header")]
|
||||
OverwriteHeader = 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Automatically replace insecure JavaScript libraries with safer and faster
|
||||
/// alternatives provided under cdnjs and powered by Cloudflare. Currently supports
|
||||
/// the following libraries: Polyfill under polyfill.io.
|
||||
/// </summary>
|
||||
public class ReplaceInsecureJS : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReplaceInsecureJS"/> class.
|
||||
/// </summary>
|
||||
public ReplaceInsecureJS()
|
||||
{
|
||||
Id = ZoneSettingId.ReplaceInsecureJS;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Turn on or off whether Cloudflare should wait for an entire file from the origin
|
||||
/// server before forwarding it to the site visitor. By default, Cloudflare sends
|
||||
/// packets to the client as they arrive from the origin server.
|
||||
/// </summary>
|
||||
public class ResponseBuffering : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ResponseBuffering"/> class.
|
||||
/// </summary>
|
||||
public ResponseBuffering()
|
||||
{
|
||||
Id = ZoneSettingId.ResponseBuffering;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The status of Response Buffering.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Turn on or off Rocket Loader in the Cloudflare Speed app.
|
||||
/// </summary>
|
||||
public class RocketLoader : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RocketLoader"/> class.
|
||||
/// </summary>
|
||||
public RocketLoader()
|
||||
{
|
||||
Id = ZoneSettingId.RocketLoader;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The status of Rocket Loader.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
69
src/Extensions/Cloudflare.Zones/Models/Settings/SSL.cs
Normal file
69
src/Extensions/Cloudflare.Zones/Models/Settings/SSL.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Control options for the SSL feature of the Edge Certificates tab in the
|
||||
/// Cloudflare SSL/TLS app.
|
||||
/// </summary>
|
||||
public class SSL : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialize a new instance of the <see cref="SSL"/> class.
|
||||
/// </summary>
|
||||
public SSL()
|
||||
{
|
||||
Id = ZoneSettingId.SSL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The encryption mode that Cloudflare uses to connect to your origin server.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public SslMode? Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SSL encryption modes.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L1307">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum SslMode
|
||||
{
|
||||
/// <summary>
|
||||
/// No encryption applied.
|
||||
/// Turning off SSL disables HTTPS and causes browsers to show a warning that your website is not secure.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "off")]
|
||||
Off = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Enable encryption only between your visitors and Cloudflare.
|
||||
/// This will avoid browser security warnings, but all connections between Cloudflare and your origin are made through HTTP.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "flexible")]
|
||||
Flexible = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Enable encryption end-to-end.
|
||||
/// Use this mode when your origin server supports SSL certification but does not use a valid, publicly trusted certificate.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "full")]
|
||||
Full = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Enable encryption end-to-end and enforce validation on origin certificates.
|
||||
/// Use Cloudflare’s Origin CA to generate certificates for your origin.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "strict")]
|
||||
Strict = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Enforce encryption between Cloudflare and your origin.
|
||||
/// Use this mode to guarantee connections to your origin will always be encrypted, regardless of your visitor’s request.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "origin_pull")]
|
||||
OriginPull = 5
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Enrollment in the SSL/TLS Recommender service which tries to detect and
|
||||
/// recommend (by sending periodic emails) the most secure SSL/TLS setting your
|
||||
/// origin servers support.
|
||||
/// </summary>
|
||||
[Obsolete("SSL/TLS Recommender has been decommissioned in favor of Automatic SSL/TLS: ssl_automatic_mode")]
|
||||
public class SSLRecommender : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SSLRecommender"/> class.
|
||||
/// </summary>
|
||||
public SSLRecommender()
|
||||
{
|
||||
Id = ZoneSettingId.SSLRecommender;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Time (in seconds) that a resource will be ensured to remain on Cloudflare's
|
||||
/// cache servers.
|
||||
/// </summary>
|
||||
public class SchemasEdgeCacheTTL : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SchemasEdgeCacheTTL"/> class.
|
||||
/// </summary>
|
||||
public SchemasEdgeCacheTTL()
|
||||
{
|
||||
Id = ZoneSettingId.SchemasEdgeCacheTTL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public EdgeCacheTTLValue Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The time-to-live (TTL) of the challenge.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L1873">Soruce</see>
|
||||
/// </summary>
|
||||
public enum EdgeCacheTTLValue : int
|
||||
{
|
||||
/// <summary>
|
||||
/// 30 seconds.
|
||||
/// </summary>
|
||||
HalfMinute = 30,
|
||||
|
||||
/// <summary>
|
||||
/// 1 minute.
|
||||
/// </summary>
|
||||
Minute = 60,
|
||||
|
||||
/// <summary>
|
||||
/// 5 minutes.
|
||||
/// </summary>
|
||||
FiveMinutes = 300,
|
||||
|
||||
/// <summary>
|
||||
/// 20 minutes.
|
||||
/// </summary>
|
||||
TwentyMinutes = 1200,
|
||||
|
||||
/// <summary>
|
||||
/// 30 minutes.
|
||||
/// </summary>
|
||||
HalfHour = 1800,
|
||||
|
||||
/// <summary>
|
||||
/// 1 hour.
|
||||
/// </summary>
|
||||
Hour = 3600,
|
||||
|
||||
/// <summary>
|
||||
/// 2 hours.
|
||||
/// </summary>
|
||||
TwoHours = 7200,
|
||||
|
||||
/// <summary>
|
||||
/// 3 hours.
|
||||
/// </summary>
|
||||
ThreeHours = 10800,
|
||||
|
||||
/// <summary>
|
||||
/// 4 hours.
|
||||
/// </summary>
|
||||
FourHours = 14400,
|
||||
|
||||
/// <summary>
|
||||
/// 5 hours.
|
||||
/// </summary>
|
||||
FiveHours = 18000,
|
||||
|
||||
/// <summary>
|
||||
/// 8 hours.
|
||||
/// </summary>
|
||||
EightHours = 28800,
|
||||
|
||||
/// <summary>
|
||||
/// 12 hours.
|
||||
/// </summary>
|
||||
HalfDay = 43200,
|
||||
|
||||
/// <summary>
|
||||
/// 16 hours.
|
||||
/// </summary>
|
||||
SixteenHours = 57600,
|
||||
|
||||
/// <summary>
|
||||
/// 20 hours.
|
||||
/// </summary>
|
||||
TwentyHours = 72000,
|
||||
|
||||
/// <summary>
|
||||
/// 1 day.
|
||||
/// </summary>
|
||||
Day = 86400,
|
||||
|
||||
/// <summary>
|
||||
/// 2 days.
|
||||
/// </summary>
|
||||
TwoDays = 172800,
|
||||
|
||||
/// <summary>
|
||||
/// 3 days.
|
||||
/// </summary>
|
||||
ThreeDays = 259200,
|
||||
|
||||
/// <summary>
|
||||
/// 4 days.
|
||||
/// </summary>
|
||||
FourDays = 345600,
|
||||
|
||||
/// <summary>
|
||||
/// 5 days.
|
||||
/// </summary>
|
||||
FiveDays = 432000,
|
||||
|
||||
/// <summary>
|
||||
/// 6 days.
|
||||
/// </summary>
|
||||
SixDays = 518400,
|
||||
|
||||
/// <summary>
|
||||
/// 1 week.
|
||||
/// </summary>
|
||||
Week = 604800,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Cloudflare security header for a zone.
|
||||
/// </summary>
|
||||
public class SecurityHeaders : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SecurityHeaders"/> class.
|
||||
/// </summary>
|
||||
public SecurityHeaders()
|
||||
{
|
||||
Id = ZoneSettingId.SecurityHeaders;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public SecurityHeaderValue? Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
public class SecurityHeaderValue
|
||||
{
|
||||
/// <summary>
|
||||
/// Strict Transport Security.
|
||||
/// </summary>
|
||||
[JsonProperty("strict_transport_security")]
|
||||
public SecurityHeaderStrictTransportSecurity? StrictTransportSecurity { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Strict Transport Security.
|
||||
/// </summary>
|
||||
public class SecurityHeaderStrictTransportSecurity
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether or not strict transport security is enabled.
|
||||
/// </summary>
|
||||
[JsonProperty("enabled")]
|
||||
public bool? Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Include all subdomains for strict transport security.
|
||||
/// </summary>
|
||||
[JsonProperty("include_subdomains")]
|
||||
public bool? IncludeSubdomains { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Max age in seconds of the strict transport security.
|
||||
/// </summary>
|
||||
[JsonProperty("max_age")]
|
||||
public int? MaxAge { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to include <c>X-Content-Type-Options: nosniff</c> header.
|
||||
/// </summary>
|
||||
[JsonProperty("nosniff")]
|
||||
public bool? NoSniff { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enable automatic preload of the HSTS configuration.
|
||||
/// </summary>
|
||||
[JsonProperty("preload")]
|
||||
public bool? Preload { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Control options for the <strong>Security Level</strong> feature from the <strong>Security</strong> app.
|
||||
/// </summary>
|
||||
public class SecurityLevel : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SecurityLevel"/> class.
|
||||
/// </summary>
|
||||
public SecurityLevel()
|
||||
{
|
||||
Id = ZoneSettingId.SecurityLevel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public SecurityLevelValue? Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Security levels.
|
||||
/// <see href="https://github.com/cloudflare/cloudflare-typescript/blob/v4.4.1/src/resources/zones/settings.ts#L1223">Source</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum SecurityLevelValue
|
||||
{
|
||||
/// <summary>
|
||||
/// Off.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "off")]
|
||||
Off = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Essentially off.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "essentially_off")]
|
||||
EssentiallyOff = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Low.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "low")]
|
||||
Low = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Medium.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "medium")]
|
||||
Medium = 4,
|
||||
|
||||
/// <summary>
|
||||
/// High.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "high")]
|
||||
High = 5,
|
||||
|
||||
/// <summary>
|
||||
/// Under Attack.
|
||||
/// </summary>
|
||||
[EnumMember(Value = "under_attack")]
|
||||
UnderAttack = 6
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// If there is sensitive content on your website that you want visible to real
|
||||
/// visitors, but that you want to hide from suspicious visitors, all you have to do
|
||||
/// is wrap the content with Cloudflare SSE tags. Wrap any content that you want to
|
||||
/// be excluded from suspicious visitors in the following SSE tags: <c><!--sse--></!--sse--></c>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For example: <c><!--sse-->Bad visitors won't see my phone number, 555-555-5555</!--sse--></c>
|
||||
/// <br/>
|
||||
/// Note: SSE only will work with HTML. If you have HTML minification enabled,
|
||||
/// you won't see the SSE tags in your HTML source when it's served through Cloudflare.
|
||||
/// SSE will still function in this case, as Cloudflare's HTML minification and SSE
|
||||
/// functionality occur on-the-fly as the resource moves through our network to the visitor's computer.
|
||||
/// (<see href="https://support.cloudflare.com/hc/en-us/articles/200170036"/>).
|
||||
/// </remarks>
|
||||
public class ServerSideExcludes : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ServerSideExcludes"/> class.
|
||||
/// </summary>
|
||||
public ServerSideExcludes()
|
||||
{
|
||||
Id = ZoneSettingId.ServerSideExcludes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Turn on or off the reordering of query strings. When query strings have the same
|
||||
/// structure, caching improves.
|
||||
/// </summary>
|
||||
public class SortQueryStringForCache : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SortQueryStringForCache"/> class.
|
||||
/// </summary>
|
||||
public SortQueryStringForCache()
|
||||
{
|
||||
Id = ZoneSettingId.SortQueryStringForCache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The status of Query String Sort.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace AMWD.Net.Api.Cloudflare.Zones
|
||||
{
|
||||
/// <summary>
|
||||
/// Only allows TLS1.2.
|
||||
/// </summary>
|
||||
public class TLS1_2Only : ZoneSettingBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TLS1_2Only"/> class.
|
||||
/// </summary>
|
||||
public TLS1_2Only()
|
||||
{
|
||||
Id = ZoneSettingId.TLS1_2Only;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current value of the zone setting.
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public OnOffState Value { get; set; }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user