Initial commit of basic cloudflare integration
This commit is contained in:
parent
5eb10b0802
commit
f695333664
126
src/dorkbox/Kloudflare.kt
Normal file
126
src/dorkbox/Kloudflare.kt
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox
|
||||||
|
|
||||||
|
import com.squareup.moshi.Moshi
|
||||||
|
import com.squareup.moshi.Types
|
||||||
|
import dorkbox.api.CloudflareActions
|
||||||
|
import dorkbox.api.core.CfErrorResponse
|
||||||
|
import dorkbox.api.core.CfResponse
|
||||||
|
import dorkbox.api.core.Error
|
||||||
|
import dorkbox.api.core.ISO8601Adapter
|
||||||
|
import dorkbox.api.dns.DnsRecord
|
||||||
|
import dorkbox.api.dns.DnsRecordTypeAdapter
|
||||||
|
import dorkbox.api.user.BillingHistory
|
||||||
|
import dorkbox.api.user.BillingProfile
|
||||||
|
import dorkbox.api.user.User
|
||||||
|
import dorkbox.api.zone.RatePlan
|
||||||
|
import dorkbox.api.zone.Zone
|
||||||
|
import dorkbox.api.zone.settings.ZoneSetting
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.ResponseBody
|
||||||
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.Converter
|
||||||
|
import retrofit2.Retrofit
|
||||||
|
import retrofit2.converter.moshi.MoshiConverterFactory
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
|
||||||
|
class Kloudflare(private val xAuthEmail: String, private val xAuthKey: String) {
|
||||||
|
private val logger = LoggerFactory.getLogger(Kloudflare::class.java)
|
||||||
|
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val API_BASE_URL = "https://api.cloudflare.com/client/v4/"
|
||||||
|
|
||||||
|
val errorConverter: Converter<ResponseBody, CfErrorResponse>
|
||||||
|
val cloudflare: CloudflareActions
|
||||||
|
|
||||||
|
init {
|
||||||
|
// JSON mapping to java classes
|
||||||
|
val httpClient = OkHttpClient.Builder()
|
||||||
|
|
||||||
|
val interceptor = HttpLoggingInterceptor()
|
||||||
|
interceptor.level = HttpLoggingInterceptor.Level.BODY
|
||||||
|
|
||||||
|
val client = httpClient
|
||||||
|
// .addInterceptor(interceptor) // this is the raw HTTP interceptor
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val moshi = Moshi.Builder()
|
||||||
|
.add(ISO8601Adapter())
|
||||||
|
.add(DnsRecordTypeAdapter())
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val adapter = moshi.adapter<List<String>>(Types.newParameterizedType(List::class.java, String::class.java))
|
||||||
|
|
||||||
|
|
||||||
|
val retrofit = Retrofit.Builder()
|
||||||
|
.baseUrl(API_BASE_URL)
|
||||||
|
.addConverterFactory(MoshiConverterFactory.create(moshi))
|
||||||
|
.client(client)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
errorConverter = retrofit.responseBodyConverter<CfErrorResponse>(CfErrorResponse::class.java, CfErrorResponse::class.annotations.toTypedArray())
|
||||||
|
|
||||||
|
cloudflare = retrofit.create(CloudflareActions::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> wrap(call: Call<CfResponse<T>>): T {
|
||||||
|
val response = call.execute()
|
||||||
|
|
||||||
|
val body = response.body()
|
||||||
|
if (response.isSuccessful && body != null && body.success) {
|
||||||
|
return body.result!!
|
||||||
|
}
|
||||||
|
|
||||||
|
val errorResponse = errorConverter.convert(response.errorBody()!!)
|
||||||
|
throw IOException("HTTP call failed: " + errorResponse?.errors?.joinToString { error: Error -> "[${error.code} : ${error.message}]" })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getUser() : User {
|
||||||
|
return wrap(cloudflare.getUser(xAuthEmail, xAuthKey))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getUserBillingProfile(): BillingProfile {
|
||||||
|
return wrap(cloudflare.getUserBillingProfile(xAuthEmail, xAuthKey))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getUserBillingHistory(): BillingHistory {
|
||||||
|
return wrap(cloudflare.getUserBillingHistory(xAuthEmail, xAuthKey))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun listZones(options: Map<String, String> = emptyMap()): List<Zone> {
|
||||||
|
return wrap(cloudflare.listZones(xAuthEmail, xAuthKey, options))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getZoneRatePlans(zoneIdentifier: String): RatePlan {
|
||||||
|
return wrap(cloudflare.getZoneRatePlans(xAuthEmail, xAuthKey, zoneIdentifier))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getZoneSettings(zoneIdentifier: String): ZoneSetting {
|
||||||
|
return wrap(cloudflare.getZoneSettings(xAuthEmail, xAuthKey, zoneIdentifier))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun listDnsRecords(zoneIdentifier: String): List<DnsRecord> {
|
||||||
|
return wrap(cloudflare.listDnsRecords(xAuthEmail, xAuthKey, zoneIdentifier))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
85
src/dorkbox/api/CloudflareActions.kt
Normal file
85
src/dorkbox/api/CloudflareActions.kt
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api
|
||||||
|
|
||||||
|
import dorkbox.api.core.CfResponse
|
||||||
|
import dorkbox.api.dns.DnsRecord
|
||||||
|
import dorkbox.api.user.BillingHistory
|
||||||
|
import dorkbox.api.user.BillingProfile
|
||||||
|
import dorkbox.api.user.User
|
||||||
|
import dorkbox.api.zone.RatePlan
|
||||||
|
import dorkbox.api.zone.Zone
|
||||||
|
import dorkbox.api.zone.settings.ZoneSetting
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.http.*
|
||||||
|
|
||||||
|
interface CloudflareActions {
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@GET("user")
|
||||||
|
fun getUser(
|
||||||
|
@Header("X-Auth-Email") email: String,
|
||||||
|
@Header("X-Auth-Key") key: String
|
||||||
|
): Call<CfResponse<User>>
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@GET("user/billing/profile")
|
||||||
|
fun getUserBillingProfile(
|
||||||
|
@Header("X-Auth-Email") email: String,
|
||||||
|
@Header("X-Auth-Key") key: String
|
||||||
|
): Call<CfResponse<BillingProfile>>
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@GET("user/billing/history")
|
||||||
|
fun getUserBillingHistory(
|
||||||
|
@Header("X-Auth-Email") email: String,
|
||||||
|
@Header("X-Auth-Key") key: String
|
||||||
|
): Call<CfResponse<BillingHistory>>
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@GET("zones")
|
||||||
|
fun listZones(
|
||||||
|
@Header("X-Auth-Email") email: String,
|
||||||
|
@Header("X-Auth-Key") key: String,
|
||||||
|
@QueryMap options: Map<String, String>
|
||||||
|
): Call<CfResponse<List<Zone>>>
|
||||||
|
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@GET("zones/{zone_identifier}/available_rate_plans")
|
||||||
|
fun getZoneRatePlans(
|
||||||
|
@Header("X-Auth-Email") email: String,
|
||||||
|
@Header("X-Auth-Key") key: String,
|
||||||
|
@Path("zone_identifier") zoneIdentifier: String
|
||||||
|
): Call<CfResponse<RatePlan>>
|
||||||
|
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@GET("zones/{zone_identifier}/settings")
|
||||||
|
fun getZoneSettings(
|
||||||
|
@Header("X-Auth-Email") email: String,
|
||||||
|
@Header("X-Auth-Key") key: String,
|
||||||
|
@Path("zone_identifier") zoneIdentifier: String
|
||||||
|
): Call<CfResponse<ZoneSetting>>
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@GET("zones/{zone_identifier}/dns_records")
|
||||||
|
fun listDnsRecords(
|
||||||
|
@Header("X-Auth-Email") email: String,
|
||||||
|
@Header("X-Auth-Key") key: String,
|
||||||
|
@Path("zone_identifier") zoneIdentifier: String
|
||||||
|
): Call<CfResponse<List<DnsRecord>>>
|
||||||
|
|
||||||
|
}
|
49
src/dorkbox/api/core/CfErrorResponse.kt
Normal file
49
src/dorkbox/api/core/CfErrorResponse.kt
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.core
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date fields will always be in UTC ISO-8601 format, including microseconds.
|
||||||
|
*/
|
||||||
|
open class CfErrorResponse {
|
||||||
|
// HTTP response codes
|
||||||
|
//200 OK request successful
|
||||||
|
//304 Not Modified
|
||||||
|
//400 Bad Request request was invalid
|
||||||
|
//401 Unauthorized user does not have permission
|
||||||
|
//403 Forbidden request not authenticated
|
||||||
|
//429 Too many requests client is rate limited
|
||||||
|
//405 Method Not Allowed incorrect HTTP method provided
|
||||||
|
//415 Unsupported Media Type response is not valid JSON
|
||||||
|
|
||||||
|
@field:[Json(name = "success")]
|
||||||
|
val success = false
|
||||||
|
|
||||||
|
@field:[Json(name = "errors")]
|
||||||
|
val errors = listOf<Error>()
|
||||||
|
|
||||||
|
@field:[Json(name = "messages")]
|
||||||
|
val messages = listOf<String>()
|
||||||
|
|
||||||
|
@field:[Json(name = "result_info")]
|
||||||
|
val resultInfo: ResultInfo? = null
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Response(success=$success, errors=$errors, messages=$messages, resultInfo=$resultInfo)"
|
||||||
|
}
|
||||||
|
}
|
55
src/dorkbox/api/core/CfResponse.kt
Normal file
55
src/dorkbox/api/core/CfResponse.kt
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.core
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date fields will always be in UTC ISO-8601 format, including microseconds.
|
||||||
|
*/
|
||||||
|
open class CfResponse<T> {
|
||||||
|
// HTTP response codes
|
||||||
|
//200 OK request successful
|
||||||
|
//304 Not Modified
|
||||||
|
//400 Bad Request request was invalid
|
||||||
|
//401 Unauthorized user does not have permission
|
||||||
|
//403 Forbidden request not authenticated
|
||||||
|
//429 Too many requests client is rate limited
|
||||||
|
//405 Method Not Allowed incorrect HTTP method provided
|
||||||
|
//415 Unsupported Media Type response is not valid JSON
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The data requested is wrapped in the result tag. If you have a response, it will always be within the result field
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "result")]
|
||||||
|
val result: T? = null
|
||||||
|
|
||||||
|
@field:[Json(name = "success")]
|
||||||
|
val success = false
|
||||||
|
|
||||||
|
@field:[Json(name = "errors")]
|
||||||
|
val errors = listOf<Error>()
|
||||||
|
|
||||||
|
@field:[Json(name = "messages")]
|
||||||
|
val messages = listOf<String>()
|
||||||
|
|
||||||
|
@field:[Json(name = "result_info")]
|
||||||
|
val resultInfo: ResultInfo? = null
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Response(result=$result, success=$success, errors=$errors, messages=$messages, resultInfo=$resultInfo)"
|
||||||
|
}
|
||||||
|
}
|
26
src/dorkbox/api/core/Error.kt
Normal file
26
src/dorkbox/api/core/Error.kt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.core
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
class Error {
|
||||||
|
@field:[Json(name = "code")]
|
||||||
|
val code = 0
|
||||||
|
|
||||||
|
@field:[Json(name = "message")]
|
||||||
|
val message = ""
|
||||||
|
}
|
52
src/dorkbox/api/core/ISO8601Adapter.kt
Normal file
52
src/dorkbox/api/core/ISO8601Adapter.kt
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.core
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.JsonQualifier
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
@JsonQualifier
|
||||||
|
annotation class ISO8601
|
||||||
|
|
||||||
|
/** Converts byte arrays to base64 (so it looks better as a string...) */
|
||||||
|
internal class ISO8601Adapter {
|
||||||
|
companion object {
|
||||||
|
// 2014-05-28T18:46:18.764425Z
|
||||||
|
private val format: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ToJson
|
||||||
|
fun toJson(@ISO8601 date: LocalDateTime): String {
|
||||||
|
return format.format(date)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
@ISO8601
|
||||||
|
fun fromJson(dateString: String): LocalDateTime {
|
||||||
|
return try {
|
||||||
|
return LocalDateTime.parse(dateString, format)
|
||||||
|
}
|
||||||
|
catch (ignored: Exception) {
|
||||||
|
// if there is an error, return epoc
|
||||||
|
LocalDateTime.now()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
56
src/dorkbox/api/core/Pagination.kt
Normal file
56
src/dorkbox/api/core/Pagination.kt
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.core
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#getting-started-requests
|
||||||
|
*/
|
||||||
|
class Pagination {
|
||||||
|
enum class Direction { ASC, DESC }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which page of results to return
|
||||||
|
*/
|
||||||
|
var page = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How many results to return per page
|
||||||
|
*/
|
||||||
|
var perPage = 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute name to order the responses by
|
||||||
|
*/
|
||||||
|
var order = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Either ASC or DESC
|
||||||
|
*/
|
||||||
|
var direction = Direction.ASC
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ResultInfo(page=$page, per_page=$perPage, order=$order, direction=$direction)"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getAsQueryStringsMap(): Map<String, Any> {
|
||||||
|
return mapOf(
|
||||||
|
"page" to page,
|
||||||
|
"per_page" to perPage,
|
||||||
|
"order" to order,
|
||||||
|
"direction" to direction.name
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
36
src/dorkbox/api/core/ResultInfo.kt
Normal file
36
src/dorkbox/api/core/ResultInfo.kt
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.core
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
class ResultInfo {
|
||||||
|
@field:[Json(name = "page")]
|
||||||
|
val page = 1
|
||||||
|
|
||||||
|
@field:[Json(name = "per_page")]
|
||||||
|
val perPage = 20
|
||||||
|
|
||||||
|
@field:[Json(name = "count")]
|
||||||
|
val count = 1
|
||||||
|
|
||||||
|
@field:[Json(name = "total_count")]
|
||||||
|
val totalCount = 200
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ResultInfo(page=$page, perPage=$perPage, count=$count, totalCount=$totalCount)"
|
||||||
|
}
|
||||||
|
}
|
21
src/dorkbox/api/dns/ARecord.kt
Normal file
21
src/dorkbox/api/dns/ARecord.kt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.dns
|
||||||
|
|
||||||
|
class ARecord : DnsRecord() {
|
||||||
|
val asd = ""
|
||||||
|
|
||||||
|
}
|
103
src/dorkbox/api/dns/DnsRecord.kt
Normal file
103
src/dorkbox/api/dns/DnsRecord.kt
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.dns
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import dorkbox.api.core.ISO8601
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#dns-records-for-a-zone-properties
|
||||||
|
*/
|
||||||
|
open class DnsRecord {
|
||||||
|
/**
|
||||||
|
* DNS record identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
var id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Record type
|
||||||
|
* A, AAAA, CNAME, TXT, SRV, LOC, MX, NS, SPF, CERT, DNSKEY, DS, NAPTR, SMIMEA, SSHFP, TLSA, URI
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "type") DnsType]
|
||||||
|
var type = RecordType.A
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DNS record name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name")]
|
||||||
|
var name= ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A valid IPv4 address
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "content")]
|
||||||
|
var content = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the record can be proxied by Cloudflare or not
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "proxiable")]
|
||||||
|
var proxiable = true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the record is receiving the performance and security benefits of Cloudflare
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "proxied")]
|
||||||
|
var proxied = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time to live for DNS record. Value of 1 is 'automatic'
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "ttl")]
|
||||||
|
var ttl = 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this record can be modified/deleted (true means it's managed by Cloudflare)
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "locked")]
|
||||||
|
var locked = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zone identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "zone_id")]
|
||||||
|
var zoneId = ""
|
||||||
|
|
||||||
|
@field:[Json(name = "zone_name")]
|
||||||
|
var zoneName = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the record was last modified
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "modified_on") ISO8601]
|
||||||
|
var modifiedOn = LocalDateTime.now()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the record was created
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "created_on") ISO8601]
|
||||||
|
var createdOn = LocalDateTime.now()
|
||||||
|
|
||||||
|
@field:[Json(name = "meta")]
|
||||||
|
var meta = Meta()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metadata about the record
|
||||||
|
*/
|
||||||
|
var data: String? = null
|
||||||
|
}
|
38
src/dorkbox/api/dns/DnsRecordTypeAdapter.kt
Normal file
38
src/dorkbox/api/dns/DnsRecordTypeAdapter.kt
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.dns
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.JsonQualifier
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
@JsonQualifier
|
||||||
|
annotation class DnsType
|
||||||
|
|
||||||
|
/** Converts byte arrays to base64 (so it looks better as a string...) */
|
||||||
|
internal class DnsRecordTypeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(@DnsType recordType: RecordType): String {
|
||||||
|
return recordType.name
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
@DnsType
|
||||||
|
fun fromJson(recordType: String): RecordType {
|
||||||
|
return RecordType.valueOf(recordType)
|
||||||
|
}
|
||||||
|
}
|
34
src/dorkbox/api/dns/Meta.kt
Normal file
34
src/dorkbox/api/dns/Meta.kt
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.dns
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#dns-records-for-a-zone-properties
|
||||||
|
*/
|
||||||
|
class Meta {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will exist if Cloudflare automatically added this DNS record during initial setup.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "auto_added")]
|
||||||
|
val autoAdded = false
|
||||||
|
|
||||||
|
|
||||||
|
@field:[Json(name = "managed_by_apps")]
|
||||||
|
val managedByApps = false
|
||||||
|
}
|
20
src/dorkbox/api/dns/RecordType.kt
Normal file
20
src/dorkbox/api/dns/RecordType.kt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.dns
|
||||||
|
|
||||||
|
enum class RecordType {
|
||||||
|
A, AAAA, CNAME, TXT, SRV, LOC, MX, NS, SPF, CERT, DNSKEY, DS, NAPTR, SMIMEA, SSHFP, TLSA, URI
|
||||||
|
}
|
79
src/dorkbox/api/user/BillingHistory.kt
Normal file
79
src/dorkbox/api/user/BillingHistory.kt
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.user
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import dorkbox.api.core.ISO8601
|
||||||
|
import dorkbox.api.zone.Zone
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#user-billing-history-billing-history
|
||||||
|
*/
|
||||||
|
class BillingHistory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Billing item identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The billing item type
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "type")]
|
||||||
|
val type = "charge"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The billing item action
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "action")]
|
||||||
|
val action = "subscription"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The billing item description
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "description")]
|
||||||
|
val description = "The billing item description"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the billing item was created
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "occurred_at") ISO8601]
|
||||||
|
val occurredAt= LocalDateTime.now()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount associated with this billing item
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "amount")]
|
||||||
|
val amount: Double = 20.99
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The monetary unit in which pricing information is displayed
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "currency")]
|
||||||
|
val currency = "USD"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "zone")]
|
||||||
|
val zone = Zone()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "BillingHistory(id='$id', type='$type', action='$action', description='$description', occurredAt=$occurredAt, amount=$amount, currency='$currency', zone=$zone)"
|
||||||
|
}
|
||||||
|
}
|
157
src/dorkbox/api/user/BillingProfile.kt
Normal file
157
src/dorkbox/api/user/BillingProfile.kt
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.user
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import dorkbox.api.core.ISO8601
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#user-billing-profile-billing-profile
|
||||||
|
*/
|
||||||
|
class BillingProfile {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The email address associated with this payment type
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "payment_email")]
|
||||||
|
val paymentEmail = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Billing profile identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first name on the billing profile
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "first_name")]
|
||||||
|
val firstName = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last name on the billing profile
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "last_name")]
|
||||||
|
val lastName = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Street address on the billing profile
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "address")]
|
||||||
|
val address = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Street address continued, apartment/suite, etc (optional)
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "address2")]
|
||||||
|
val address2 = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The company name on the billing profile
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "company")]
|
||||||
|
val company = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The city on the billing profile
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "city")]
|
||||||
|
val city = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the state/province on the billing profile
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "state")]
|
||||||
|
val state = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The zipcode on the billing profile
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "zipCode")]
|
||||||
|
val zipcode = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the country of the address on the billing profile
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "country")]
|
||||||
|
val country = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The telephone associated with the billing profile
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "telephone")]
|
||||||
|
val telephone = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last four digits of the credit card on file
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "card_number")]
|
||||||
|
val cardNumber = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The month number (1-12) of when the credit card on file expires
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "card_expiry_month")]
|
||||||
|
val cardExpiryMonth = 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The year when the credit card on file expires
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "card_expiry_year")]
|
||||||
|
val cardExpiryYear = 2020
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value Added Tax ID
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "vat")]
|
||||||
|
val vat = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Information about a customer's device collected by client SDK
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "device_data")]
|
||||||
|
val deviceData = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The gateway which was used to tokenize the payment method
|
||||||
|
* braintree, paypal
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "payment_gateway")]
|
||||||
|
val paymentGateway = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The string returned by the client SDK to represent a payment method
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "payment_nonce")]
|
||||||
|
val paymentNonce = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the profile was last modified
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "edited_on") ISO8601]
|
||||||
|
val editedOn = LocalDateTime.now()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the profile was created
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "created_on") ISO8601]
|
||||||
|
val createdOn = LocalDateTime.now()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "BillingProfile(paymentEmail='$paymentEmail', id='$id', firstName='$firstName', lastName='$lastName', address='$address', address2='$address2', company='$company', city='$city', state='$state', zipcode='$zipcode', country='$country', telephone='$telephone', cardNumber='$cardNumber', cardExpiryMonth=$cardExpiryMonth, cardExpiryYear=$cardExpiryYear, vat='$vat', deviceData='$deviceData', paymentGateway='$paymentGateway', paymentNonce='$paymentNonce', editedOn=$editedOn, createdOn=$createdOn)"
|
||||||
|
}
|
||||||
|
}
|
114
src/dorkbox/api/user/User.kt
Normal file
114
src/dorkbox/api/user/User.kt
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.user
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import dorkbox.api.core.ISO8601
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#user-properties
|
||||||
|
*/
|
||||||
|
class User {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of betas the user is currently participating in. If a beta is zone-specific, the beta will apply to all zones.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "betas")]
|
||||||
|
val betas = listOf<String>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of the organizations the user is a member of (or invited to) and the permissions granted to them.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "organizations")]
|
||||||
|
val organizations = listOf<UserOrganization>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User's telephone number
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "telephone")]
|
||||||
|
val telephone: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The zipcode or postal code where the user lives.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "zipcode")]
|
||||||
|
val zipcode: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User's last name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "last_name")]
|
||||||
|
val lastName: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Last time the user was modified
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "modified_on") ISO8601]
|
||||||
|
val modifiedOn= LocalDateTime.now()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A username used to access other cloudflare services, like support
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "username")]
|
||||||
|
val userName = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the user signed up.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "created_on") ISO8601]
|
||||||
|
val createdOn= LocalDateTime.now()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The country in which the user lives.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "country")]
|
||||||
|
val country: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether two-factor authentication is enabled for the user account. This does not apply to API authentication
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "two_factor_authentication_enabled")]
|
||||||
|
val twoFactorAuthenticationEnabled = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User's first name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "first_name")]
|
||||||
|
val firstName: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the user is prevented from performing certain actions within their account
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "suspended")]
|
||||||
|
val suspended = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Your contact email address
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "email")]
|
||||||
|
val email = ""
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "User(betas=$betas, organizations=$organizations, telephone=$telephone, zipcode=$zipcode, lastName=$lastName, modifiedOn=$modifiedOn, userName='$userName', createdOn=$createdOn, country=$country, twoFactorAuthenticationEnabled=$twoFactorAuthenticationEnabled, firstName=$firstName, id='$id', suspended=$suspended, email='$email')"
|
||||||
|
}
|
||||||
|
}
|
58
src/dorkbox/api/user/UserOrganization.kt
Normal file
58
src/dorkbox/api/user/UserOrganization.kt
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.user
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#user-s-organizations-list-organizations
|
||||||
|
*/
|
||||||
|
class UserOrganization {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Organization identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Organization Name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name")]
|
||||||
|
val name = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not the user is a member of the organization or has an inivitation pending
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "status")]
|
||||||
|
val status = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access permissions for this User
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "permissions")]
|
||||||
|
val permissions = listOf<String>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of role names for the User at the Organization
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "roles")]
|
||||||
|
val roles= listOf<String>()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "UserOrganization(id='$id', name='$name', status='$status', permissions=$permissions, roles=$roles)"
|
||||||
|
}
|
||||||
|
}
|
91
src/dorkbox/api/user/invite/Invite.kt
Normal file
91
src/dorkbox/api/user/invite/Invite.kt
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.user.invite
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import dorkbox.api.core.ISO8601
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#user-s-invites-properties
|
||||||
|
*/
|
||||||
|
class Invite {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the invite was sent
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "invited_on") ISO8601]
|
||||||
|
val invitedOn= LocalDateTime.now()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the Organization the user will be added to
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "organization_id")]
|
||||||
|
val organizationId: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the invite is no longer active
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "expires_on")]
|
||||||
|
val expiresOn: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current status of the invitation
|
||||||
|
* pending, accepted, rejected, expired
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "status")]
|
||||||
|
val status = "pending"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Organization Name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "organization_name")]
|
||||||
|
val organizationName = "Cloudflare, Inc."
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The email address of the user who created the invite
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "invited_by")]
|
||||||
|
val invitedBy: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email address of the user to be added to the Organization
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "invited_member_email")]
|
||||||
|
val invitedMemberEmail: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invite identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id of the user to be added to the Organization
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "invited_member_id")]
|
||||||
|
val invitedMemberId: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roles to be assigned to this Member
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "roles")]
|
||||||
|
val roles = listOf<Role>()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Invite(invitedOn=$invitedOn, organizationId=$organizationId, expiresOn=$expiresOn, status='$status', organizationName='$organizationName', invitedBy=$invitedBy, invitedMemberEmail=$invitedMemberEmail, id='$id', invitedMemberId=$invitedMemberId, roles=$roles)"
|
||||||
|
}
|
||||||
|
}
|
54
src/dorkbox/api/user/invite/Role.kt
Normal file
54
src/dorkbox/api/user/invite/Role.kt
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.user.invite
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#user-s-invites-properties
|
||||||
|
*/
|
||||||
|
class Role {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Role identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Role Name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name")]
|
||||||
|
val name: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of role's permissions
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "description")]
|
||||||
|
val description: String? = null
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access permissions for this User
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "permissions")]
|
||||||
|
val permissions = listOf<String>()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Role(id='$id', name=$name, description=$description, permissions=$permissions)"
|
||||||
|
}
|
||||||
|
}
|
27
src/dorkbox/api/user/subscription/App.kt
Normal file
27
src/dorkbox/api/user/subscription/App.kt
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.user.subscription
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
class App {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app install id
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "install_id")]
|
||||||
|
val installId = ""
|
||||||
|
}
|
48
src/dorkbox/api/user/subscription/ComponentValue.kt
Normal file
48
src/dorkbox/api/user/subscription/ComponentValue.kt
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.user.subscription
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#user-subscription-properties
|
||||||
|
*/
|
||||||
|
class ComponentValue {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the component_value
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name")]
|
||||||
|
val name = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of the component value assigned
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default amount assigned.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "default")]
|
||||||
|
val default = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unit price for the component value
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "price")]
|
||||||
|
val price = 0
|
||||||
|
}
|
70
src/dorkbox/api/user/subscription/RatePlan.kt
Normal file
70
src/dorkbox/api/user/subscription/RatePlan.kt
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.user.subscription
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#user-subscription-properties
|
||||||
|
*/
|
||||||
|
class RatePlan {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the rate_plan
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The full name of the rate plan
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "public_name")]
|
||||||
|
val publicName = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The currency applied to the rate_plan subscription
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "currency")]
|
||||||
|
val currency = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scope that this rate_plan applies to
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "scope")]
|
||||||
|
val scope = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of sets this rate_plan applies to
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "sets")]
|
||||||
|
val sets = listOf<String>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not a rate_plan is enterprise-based (or newly adopted term contract)
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "is_contract")]
|
||||||
|
val isContract = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this rate_plan is managed externally from Cloudflare
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "externally_managed")]
|
||||||
|
val externallyManaged = false
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "RatePlan(id='$id', publicName='$publicName', currency='$currency', scope='$scope', sets=$sets, isContract=$isContract, externallyManaged=$externallyManaged)"
|
||||||
|
}
|
||||||
|
}
|
101
src/dorkbox/api/user/subscription/Subscription.kt
Normal file
101
src/dorkbox/api/user/subscription/Subscription.kt
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.user.subscription
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import dorkbox.api.core.ISO8601
|
||||||
|
import dorkbox.api.zone.Zone
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#user-subscription-properties
|
||||||
|
*/
|
||||||
|
class Subscription {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The end of the current period, and also when the next billing is due
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "app")]
|
||||||
|
val app = App()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The end of the current period, and also when the next billing is due
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "current_period_end") ISO8601]
|
||||||
|
val currentPeriodEnd= LocalDateTime.now()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of add-ons subscribed to
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "component_values")]
|
||||||
|
val componentValues = listOf<ComponentValue>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The rate plan applied to the subscription
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "rate_plan")]
|
||||||
|
val ratePlan = RatePlan()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The price of the subscription that will be billed, in US dollars
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "price")]
|
||||||
|
val price = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the current billing period started, may be the same as InitialPeriodStart if this is the first period
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "current_period_start") ISO8601]
|
||||||
|
val currentPeriodStart = LocalDateTime.now()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple zone object. May have null properties if not a zone subscription.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "zone")]
|
||||||
|
val zone = Zone()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The monetary unit in which pricing information is displayed
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "currency")]
|
||||||
|
val currency = "USD"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The state that the subscription is in
|
||||||
|
*
|
||||||
|
* Trial, Provisioned, Paid, AwaitingPayment, Cancelled, Failed, Expired
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "state")]
|
||||||
|
val state = "Expired"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscription identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How often the subscription is renewed automatically
|
||||||
|
*
|
||||||
|
* weekly, monthly, quarterly, yearly
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "frequency")]
|
||||||
|
val frequency = "weekly"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Subscription(app=$app, currentPeriodEnd=$currentPeriodEnd, componentValues=$componentValues, ratePlan=$ratePlan, price=$price, currentPeriodStart=$currentPeriodStart, zone=$zone, currency='$currency', state='$state', id='$id', frequency='$frequency')"
|
||||||
|
}
|
||||||
|
}
|
40
src/dorkbox/api/zone/Account.kt
Normal file
40
src/dorkbox/api/zone/Account.kt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#zone-properties
|
||||||
|
*/
|
||||||
|
class Account {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name")]
|
||||||
|
val name = ""
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Account(id='$id', name='$name')"
|
||||||
|
}
|
||||||
|
}
|
47
src/dorkbox/api/zone/Component.kt
Normal file
47
src/dorkbox/api/zone/Component.kt
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#zone-properties
|
||||||
|
*/
|
||||||
|
class Component {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique component
|
||||||
|
* zones, page_rules, dedicated_certificates, dedicated_certificates_custom
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name")]
|
||||||
|
val name: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default amount allocated
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "default")]
|
||||||
|
val default = 5
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unit price of the addon
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "unit_price")]
|
||||||
|
val unitPrice = 0
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Components(name=$name, default=$default, unitPrice=$unitPrice)"
|
||||||
|
}
|
||||||
|
}
|
40
src/dorkbox/api/zone/Owner.kt
Normal file
40
src/dorkbox/api/zone/Owner.kt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#zone-properties
|
||||||
|
*/
|
||||||
|
class Owner {
|
||||||
|
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of owner of the zone
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "email")]
|
||||||
|
val email = ""
|
||||||
|
|
||||||
|
@field:[Json(name = "owner_type")]
|
||||||
|
val ownerType = "user"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Owner(id='$id', email='$email', ownerType='$ownerType')"
|
||||||
|
}
|
||||||
|
}
|
78
src/dorkbox/api/zone/Plan.kt
Normal file
78
src/dorkbox/api/zone/Plan.kt
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#zone-properties
|
||||||
|
*/
|
||||||
|
class Plan {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plan identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plan name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name")]
|
||||||
|
val name: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The price of the subscription that will be billed, in US dollars
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "price")]
|
||||||
|
val price = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The monetary unit in which pricing information is displayed
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "currency")]
|
||||||
|
val currency = "USD"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The frequency at which you will be billed for this plan
|
||||||
|
* weekly, monthly, quarterly, yearly
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "frequency")]
|
||||||
|
val frequency = "weekly"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 'friendly' identifier to indicate to the UI what plan the object is
|
||||||
|
* free, pro, business, enterprise
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "legacy_id")]
|
||||||
|
val legacyId = "free"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the zone is subscribed to this plan
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "is_subscribed")]
|
||||||
|
val isSubscribed = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the zone is allowed to subscribe to this plan
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "can_subscribe")]
|
||||||
|
val canSubscribe = false
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Plan(id='$id', name=$name, price=$price, currency='$currency', frequency='$frequency', legacyId='$legacyId', isSubscribed=$isSubscribed, canSubscribe=$canSubscribe)"
|
||||||
|
}
|
||||||
|
}
|
78
src/dorkbox/api/zone/PlanPending.kt
Normal file
78
src/dorkbox/api/zone/PlanPending.kt
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#zone-properties
|
||||||
|
*/
|
||||||
|
class PlanPending {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plan identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plan name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name")]
|
||||||
|
val name = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The price of the subscription that will be billed, in US dollars
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "price")]
|
||||||
|
val price = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The monetary unit in which pricing information is displayed
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "currency")]
|
||||||
|
val currency = "USD"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The frequency at which you will be billed for this plan
|
||||||
|
* weekly, monthly, quarterly, yearly
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "frequency")]
|
||||||
|
val frequency = "weekly"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 'friendly' identifier to indicate to the UI what plan the object is
|
||||||
|
* free, pro, business, enterprise
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "legacy_id")]
|
||||||
|
val legacyId = "free"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the zone is subscribed to this plan
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "is_subscribed")]
|
||||||
|
val isSubscribed = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the zone is allowed to subscribe to this plan
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "can_subscribe")]
|
||||||
|
val canSubscribe = false
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "PlanPending(id='$id', name='$name', price=$price, currency='$currency', frequency='$frequency', legacyId='$legacyId', isSubscribed=$isSubscribed, canSubscribe=$canSubscribe)"
|
||||||
|
}
|
||||||
|
}
|
65
src/dorkbox/api/zone/RatePlan.kt
Normal file
65
src/dorkbox/api/zone/RatePlan.kt
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#zone-properties
|
||||||
|
*/
|
||||||
|
class RatePlan {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plan identifier tag
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = "free"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plan name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name")]
|
||||||
|
val name = "Free Plan"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The monetary unit in which pricing information is displayed
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "currency")]
|
||||||
|
val currency = "USD"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The duration of the plan subscription
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "duration")]
|
||||||
|
val duration = 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The frequency at which you will be billed for this plan
|
||||||
|
* weekly, monthly, quarterly, yearly
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "frequency")]
|
||||||
|
val frequency = "monthly"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of available components values for the plan
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "components")]
|
||||||
|
val components = listOf<Component>()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "RatePlan(id='$id', name='$name', currency='$currency', duration=$duration, frequency='$frequency', components=$components)"
|
||||||
|
}
|
||||||
|
}
|
139
src/dorkbox/api/zone/Zone.kt
Normal file
139
src/dorkbox/api/zone/Zone.kt
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import dorkbox.api.core.ISO8601
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://api.cloudflare.com/#zone-properties
|
||||||
|
*/
|
||||||
|
class Zone {
|
||||||
|
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id: String = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The domain name
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name")]
|
||||||
|
val name = "example.com"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interval (in seconds) from when development mode expires (positive integer) or last expired (negative integer) for the domain. If development mode has never been enabled, this value is 0.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "development_mode")]
|
||||||
|
val developmentMode = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Original name servers before moving to Cloudflare
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "original_name_servers")]
|
||||||
|
val originalNameServers: List<String>? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registrar for the domain at the time of switching to Cloudflare
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "original_registrar")]
|
||||||
|
val originalRegistrar: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DNS host at the time of switching to Cloudflare
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "original_dnshost")]
|
||||||
|
val originalDnshost: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the zone was created
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "created_on") ISO8601]
|
||||||
|
val createdOn = LocalDateTime.now()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the zone was last modified
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "modified_on") ISO8601]
|
||||||
|
val modifiedOn = LocalDateTime.now()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cloudflare-assigned name servers. This is only populated for zones that use Cloudflare DNS
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "name_servers")]
|
||||||
|
val nameServers = listOf<String>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Information about the owner of the zone
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "owner")]
|
||||||
|
val owner = Owner()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Information about the account the zone belongs to
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "account")]
|
||||||
|
val account = Account()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Available permissions on the zone for the current user requesting the item
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "permissions")]
|
||||||
|
val permissions = listOf<String>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A zone plan
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "plan")]
|
||||||
|
val plan = Plan()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A zone plan
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "plan_pending")]
|
||||||
|
val planPending = PlanPending()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status of the zone
|
||||||
|
* active, pending, initializing, moved, deleted, deactivated
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "status")]
|
||||||
|
val status = "active"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last time proof of ownership was detected and the zone was made active
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "activated_on") ISO8601]
|
||||||
|
val activatedOn: LocalDateTime? = null
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the zone is only using Cloudflare DNS services. A true value means the zone will not receive security or performance benefits.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "paused")]
|
||||||
|
val paused = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A full zone implies that DNS is hosted with Cloudflare. A partial zone is typically a partner-hosted zone or a CNAME setup.
|
||||||
|
* full, partial
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "type")]
|
||||||
|
val type = "full"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Zone(id=$id, name='$name', developmentMode=$developmentMode, originalNameServers=$originalNameServers, originalRegistrar=$originalRegistrar, originalDnshost=$originalDnshost, createdOn=$createdOn, modifiedOn=$modifiedOn, nameServers=$nameServers, owner=$owner, account=$account, permissions=$permissions, plan=$plan, planPending=$planPending, status='$status', activatedOn=$activatedOn, paused=$paused, type='$type')"
|
||||||
|
}
|
||||||
|
}
|
45
src/dorkbox/api/zone/settings/MinifyAssetsSetting.kt
Normal file
45
src/dorkbox/api/zone/settings/MinifyAssetsSetting.kt
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone.settings
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
class MinifyAssetsSetting {
|
||||||
|
/**
|
||||||
|
* Account identifier tag
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "css")]
|
||||||
|
val css = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account identifier tag
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "html")]
|
||||||
|
val html = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account identifier tag
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "js")]
|
||||||
|
val js = ""
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "MinifyAssets(css='$css', html='$html', js='$js')"
|
||||||
|
}
|
||||||
|
}
|
46
src/dorkbox/api/zone/settings/MobileRedirectSetting.kt
Normal file
46
src/dorkbox/api/zone/settings/MobileRedirectSetting.kt
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone.settings
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
class MobileRedirectSetting {
|
||||||
|
/**
|
||||||
|
* Whether or not the mobile redirection is enabled
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "status")]
|
||||||
|
val status = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which subdomain prefix you wish to redirect visitors on mobile devices to (subdomain must already exist).
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "mobile_subdomain")]
|
||||||
|
val mobileSubdomain: String? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to drop the current page path and redirect to the mobile subdomain URL root or to keep the path and redirect to the same page on the mobile subdomain
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "strip_uri")]
|
||||||
|
val strip_uri = false
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "MobileRedirectSetting(status='$status', mobileSubdomain=$mobileSubdomain, strip_uri=$strip_uri)"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
48
src/dorkbox/api/zone/settings/SecurityHeadingSetting.kt
Normal file
48
src/dorkbox/api/zone/settings/SecurityHeadingSetting.kt
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone.settings
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
class SecurityHeadingSetting {
|
||||||
|
/**
|
||||||
|
* Whether or not strict transport security is enabled
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "enabled")]
|
||||||
|
val enabled = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Max age in seconds of the strict transport security
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "max_age")]
|
||||||
|
val maxAge = 1234
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include all subdomains for strict transport security
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "include_subdomains")]
|
||||||
|
val includeSubdomains = true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not to include 'X-Content-Type-Options: nosniff' header
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "nosniff")]
|
||||||
|
val noSniff = true
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "SecurityHeadingSetting(enabled=$enabled, maxAge=$maxAge, includeSubdomains=$includeSubdomains, noSniff=$noSniff)"
|
||||||
|
}
|
||||||
|
}
|
822
src/dorkbox/api/zone/settings/ZoneSetting.kt
Normal file
822
src/dorkbox/api/zone/settings/ZoneSetting.kt
Normal file
@ -0,0 +1,822 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 dorkbox, llc
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.api.zone.settings
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import dorkbox.api.core.ISO8601
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Always Online Mode
|
||||||
|
*/
|
||||||
|
class AlwaysOnline : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "AlwaysOnline(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Advanced DDoS Protection
|
||||||
|
*/
|
||||||
|
class AdvancedDDos : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* notes: Defaults to on for Business+ plans
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "off"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "AdvancedDDos(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Brotli Compression
|
||||||
|
*/
|
||||||
|
class Brotli : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Brotli(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Browser Cache TTL
|
||||||
|
*/
|
||||||
|
class BrowserCacheTtl : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
*
|
||||||
|
* valid values: 30, 60, 300, 1200, 1800, 3600, 7200, 10800, 14400, 18000, 28800, 43200, 57600, 72000, 86400,
|
||||||
|
* 172800, 259200, 345600, 432000, 691200, 1382400, 2073600, 2678400, 5356800, 16070400, 31536000
|
||||||
|
*
|
||||||
|
* notes: The minimum TTL available depends on the plan level of the zone. (Enterprise = 30, Business = 1800, Pro = 1800, Free = 1800)
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = 14400
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "BrowserCacheTtl(value=$value)" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Browser Check
|
||||||
|
*/
|
||||||
|
class BrowserCheck : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "BrowserCheck(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cloudflare CNAME Flattening
|
||||||
|
*/
|
||||||
|
class FlattenAtRoot: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* flatten_at_root, flatten_all
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "flatten_at_root"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "FlattenAtRoot(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cloudflare Cache Level
|
||||||
|
*/
|
||||||
|
class CacheLevel: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* aggressive, basic, simplified
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "aggressive"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "CacheLevel(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Challenge Page TTL
|
||||||
|
*/
|
||||||
|
class ChallengePageTtl: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
*
|
||||||
|
* valid values: 300, 900, 1800, 2700, 3600, 7200, 10800, 14400, 28800, 57600, 86400, 604800, 2592000, 31536000
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = 1800
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ChallengePageTtl(value=$value)" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Development Mode
|
||||||
|
*/
|
||||||
|
class DevelopmentMode: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
*
|
||||||
|
* 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 false.
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "time_remaining")]
|
||||||
|
val timeRemaining = 0
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "DevelopmentMode(value='$value', timeRemaining=$timeRemaining)" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edge Cache TTL
|
||||||
|
*/
|
||||||
|
class EdgeCacheTtl: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
*
|
||||||
|
* valid values: 30, 60, 300, 1200, 1800, 3600, 7200, 10800, 14400, 18000, 28800, 43200, 57600, 72000, 86400, 172800, 259200, 345600, 432000, 518400, 604800
|
||||||
|
*
|
||||||
|
* notes: The minimum TTL available depends on the plan level of the zone. (Enterprise = 30, Business = 1800, Pro = 3600, Free = 7200)
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = 1800
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "EdgeCacheTtl(value=$value)" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error Pages On
|
||||||
|
*/
|
||||||
|
class ErrorPagesOn: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ErrorPagesOn(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get String Sort
|
||||||
|
*/
|
||||||
|
class StringSort: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "StringSort(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email Obfuscation
|
||||||
|
*/
|
||||||
|
class EmailObfuscation: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "EmailObfuscation(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hotlink Protection
|
||||||
|
*/
|
||||||
|
class HotlinkProtection: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "HotlinkProtection(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IP Geolocation
|
||||||
|
*/
|
||||||
|
class IpGeolocation: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "IpGeolocation(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IPv6
|
||||||
|
*/
|
||||||
|
class IPv6: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "IPv6(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebSockets
|
||||||
|
*/
|
||||||
|
class Websockets: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Websockets(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle SHA1 support
|
||||||
|
*/
|
||||||
|
class ToggleSha1: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ToggleSha1(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TLS1.2 Only
|
||||||
|
*/
|
||||||
|
class Tls1_2Only: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Tls1_2Only(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-Minify Assets
|
||||||
|
*/
|
||||||
|
class AutoMinify: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = MinifyAssetsSetting()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "AutoMinify(value=$value)" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Max Upload
|
||||||
|
*/
|
||||||
|
class MaxUpload: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* valid values: 100, 200, 500
|
||||||
|
*
|
||||||
|
* notes: The size depends on the plan level of the zone. (Enterprise = 500, Business = 200, Pro = 100, Free = 100)
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = 100
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "MaxUpload(value=$value)" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mobile Redirect
|
||||||
|
*/
|
||||||
|
class MobileRedirect: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = MobileRedirectSetting()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "MobileRedirect(value=$value)" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mirage Image Optimization
|
||||||
|
*/
|
||||||
|
class Mirage: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "Mirage(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Polish Image Optimization
|
||||||
|
*/
|
||||||
|
class PolishImage: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* off, lossless, lossy
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "off"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "PolishImage(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Polish WebP Conversion
|
||||||
|
*/
|
||||||
|
class PolishWebP: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "PolishWebP(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefetch Preload
|
||||||
|
*/
|
||||||
|
class PrefetchPreload: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "PrefetchPreload(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Privacy Pass
|
||||||
|
*/
|
||||||
|
class PrivatePass: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "PrivatePass(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response Buffering
|
||||||
|
*/
|
||||||
|
class ReponseBuffering: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ReponseBuffering(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rocket Loader
|
||||||
|
*/
|
||||||
|
class RocketLoader: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "RocketLoader(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Security Header
|
||||||
|
*/
|
||||||
|
class SecurityHeader: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Current value of the zone setting
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = SecurityHeadingSetting()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "SecurityHeader(value=$value)" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Security Level
|
||||||
|
*/
|
||||||
|
class SecurityLevel: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = SecurityHeadingSetting()
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "SecurityLevel(value=$value)" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server Side Exclude
|
||||||
|
*/
|
||||||
|
class ServerSideExclude: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ServerSideExclude(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SSL
|
||||||
|
*/
|
||||||
|
class SSL: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* off, flexible, full, strict
|
||||||
|
*
|
||||||
|
* notes: Depends on the zone's plan level
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "off"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "SSL(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TLS Client Authentication
|
||||||
|
*/
|
||||||
|
class TlsClientAuth: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* off, flexible, full, strict
|
||||||
|
*
|
||||||
|
* notes: Depends on the zone's plan level
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "off"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "TlsClientAuth(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True Client IP Header
|
||||||
|
*/
|
||||||
|
class TrueClientIPHeader: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* off, flexible, full, strict
|
||||||
|
*
|
||||||
|
* notes: Depends on the zone's plan level
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "off"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "TrueClientIPHeader(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Web Application Firewall
|
||||||
|
*/
|
||||||
|
class WebApplicationFirewall: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "WebApplicationFirewall(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zone Minimum TLS Version Value
|
||||||
|
*/
|
||||||
|
class ZoneMinimumTLSVersionValue: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* 1.0, 1.1, 1.2, 1.3
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = 1.0
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ZoneMinimumTLSVersionValue(value=$value)" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zone Enable TLS 1.3
|
||||||
|
*/
|
||||||
|
class ZoneEnableTLS1_3: ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off, zrt
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ZoneEnableTLS1_3(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zone Enable Opportunistic Encryption
|
||||||
|
*/
|
||||||
|
class ZoneEnableOpportunisticEncryption : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off, zrt
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ZoneEnableOpportunisticEncryption(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zone Enable Automatic HTTPS Rewrites
|
||||||
|
*/
|
||||||
|
class ZoneEnableAutomaticHTTPSRewrites : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off, zrt
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ZoneEnableAutomaticHTTPSRewrites(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP2
|
||||||
|
*/
|
||||||
|
class HTTP2 : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off, zrt
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "HTTP2(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pseudo IPv4 Value
|
||||||
|
*/
|
||||||
|
class PseudoIPv4 : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* off, add_header, overwrite_header
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "PseudoIPv4(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zone Enable Always Use HTTPS
|
||||||
|
*/
|
||||||
|
class ZoneEnableAlwaysUseHTTPS : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ZoneEnableAlwaysUseHTTPS(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zone Enable Onion Routing
|
||||||
|
*/
|
||||||
|
class ZoneEnableOnionRouting : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ZoneEnableOnionRouting(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Image Resizing
|
||||||
|
*/
|
||||||
|
class ImageResizing : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
*on, off
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ImageResizing(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP/2 Edge Prioritization
|
||||||
|
*/
|
||||||
|
class HTTP2EdgePrioritization : ZoneSetting() {
|
||||||
|
/**
|
||||||
|
* Value of the zone setting
|
||||||
|
* on, off, custom
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "value")]
|
||||||
|
val value = "on"
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "HTTP2EdgePrioritization(value='$value')" + super.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see [https://api.cloudflare.com](https://api.cloudflare.com/#zone-properties)
|
||||||
|
*/
|
||||||
|
open class ZoneSetting {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the zone setting
|
||||||
|
* always_online, advanced_ddos, brotli, browser_cache_ttl, browser_check, flatten_at_root, cache_level, challenge_ttl,
|
||||||
|
* development_mode, edge_cache_ttl, origin_error_page_pass_thru, sort_query_string_for_cache, email_obfuscation,
|
||||||
|
* hotlink_protection, ip_geolocation, ipv6, websockets, sha1_support, tls_1_2_only, minify, max_upload, mobile_redirect,
|
||||||
|
* mirage, polish, webp, prefetch_preload, privacy_pass, response_buffering, rocket_loader, security_header, security_level,
|
||||||
|
* server_side_exclude, ssl, tls_client_auth, true_client_ip_header, waf, min_tls_version, tls_1_3, opportunistic_encryption,
|
||||||
|
* automatic_https_rewrites, http2, , pseudo_ipv4, always_use_https, opportunistic_onion, image_resizing, h2_prioritization
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "id")]
|
||||||
|
val id = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not this setting can be modified for this zone (based on your Cloudflare plan level)
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "editable")]
|
||||||
|
val editable = true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* last time this setting was modified
|
||||||
|
*/
|
||||||
|
@field:[Json(name = "modified_on") ISO8601]
|
||||||
|
val modifiedOn: LocalDateTime? = null
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ZoneSetting(id='$id', editable=$editable, modifiedOn=$modifiedOn)"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user