Updated packages to reflect project name.

This commit is contained in:
nathan 2019-07-28 16:37:14 +02:00
parent 48403e5304
commit 51cef6cef6
41 changed files with 95 additions and 99 deletions

View File

@ -13,30 +13,29 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare package dorkbox.kloudflareApi
import com.squareup.moshi.Moshi import com.squareup.moshi.Moshi
import dorkbox.kloudflare.api.CloudflareActions import dorkbox.kloudflareApi.api.CloudflareActions
import dorkbox.kloudflare.api.core.CfErrorResponse import dorkbox.kloudflareApi.api.core.CfErrorResponse
import dorkbox.kloudflare.api.core.CfResponse import dorkbox.kloudflareApi.api.core.CfResponse
import dorkbox.kloudflare.api.core.DnsRecordTypeAdapter import dorkbox.kloudflareApi.api.core.DnsRecordTypeAdapter
import dorkbox.kloudflare.api.core.Error import dorkbox.kloudflareApi.api.core.Error
import dorkbox.kloudflare.api.core.ISO8601Adapter import dorkbox.kloudflareApi.api.core.ISO8601Adapter
import dorkbox.kloudflare.api.dns.CreateDnsRecord import dorkbox.kloudflareApi.api.dns.CreateDnsRecord
import dorkbox.kloudflare.api.dns.DeleteDnsRecord import dorkbox.kloudflareApi.api.dns.DeleteDnsRecord
import dorkbox.kloudflare.api.dns.DnsRecord import dorkbox.kloudflareApi.api.dns.DnsRecord
import dorkbox.kloudflare.api.dns.UpdateDnsRecord import dorkbox.kloudflareApi.api.dns.UpdateDnsRecord
import dorkbox.kloudflare.api.firewall.AccessRule import dorkbox.kloudflareApi.api.firewall.AccessRule
import dorkbox.kloudflare.api.user.BillingHistory import dorkbox.kloudflareApi.api.user.BillingHistory
import dorkbox.kloudflare.api.user.BillingProfile import dorkbox.kloudflareApi.api.user.BillingProfile
import dorkbox.kloudflare.api.user.User import dorkbox.kloudflareApi.api.user.User
import dorkbox.kloudflare.api.zone.RatePlan import dorkbox.kloudflareApi.api.zone.RatePlan
import dorkbox.kloudflare.api.zone.Zone import dorkbox.kloudflareApi.api.zone.Zone
import dorkbox.kloudflare.api.zone.settings.ZoneSetting import dorkbox.kloudflareApi.api.zone.settings.ZoneSetting
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.ResponseBody import okhttp3.ResponseBody
import okhttp3.logging.HttpLoggingInterceptor import okhttp3.logging.HttpLoggingInterceptor
import org.slf4j.LoggerFactory
import retrofit2.Call import retrofit2.Call
import retrofit2.Converter import retrofit2.Converter
import retrofit2.Retrofit import retrofit2.Retrofit
@ -45,9 +44,6 @@ import java.io.IOException
class Kloudflare(private val xAuthEmail: String, private val xAuthKey: String) { class Kloudflare(private val xAuthEmail: String, private val xAuthKey: String) {
private val logger = LoggerFactory.getLogger(Kloudflare::class.java)
companion object { companion object {
private const val API_BASE_URL = "https://api.cloudflare.com/client/v4/" private const val API_BASE_URL = "https://api.cloudflare.com/client/v4/"

View File

@ -13,20 +13,20 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api package dorkbox.kloudflareApi.api
import dorkbox.kloudflare.api.core.CfResponse import dorkbox.kloudflareApi.api.core.CfResponse
import dorkbox.kloudflare.api.dns.CreateDnsRecord import dorkbox.kloudflareApi.api.dns.CreateDnsRecord
import dorkbox.kloudflare.api.dns.DeleteDnsRecord import dorkbox.kloudflareApi.api.dns.DeleteDnsRecord
import dorkbox.kloudflare.api.dns.DnsRecord import dorkbox.kloudflareApi.api.dns.DnsRecord
import dorkbox.kloudflare.api.dns.UpdateDnsRecord import dorkbox.kloudflareApi.api.dns.UpdateDnsRecord
import dorkbox.kloudflare.api.firewall.AccessRule import dorkbox.kloudflareApi.api.firewall.AccessRule
import dorkbox.kloudflare.api.user.BillingHistory import dorkbox.kloudflareApi.api.user.BillingHistory
import dorkbox.kloudflare.api.user.BillingProfile import dorkbox.kloudflareApi.api.user.BillingProfile
import dorkbox.kloudflare.api.user.User import dorkbox.kloudflareApi.api.user.User
import dorkbox.kloudflare.api.zone.RatePlan import dorkbox.kloudflareApi.api.zone.RatePlan
import dorkbox.kloudflare.api.zone.Zone import dorkbox.kloudflareApi.api.zone.Zone
import dorkbox.kloudflare.api.zone.settings.ZoneSetting import dorkbox.kloudflareApi.api.zone.settings.ZoneSetting
import retrofit2.Call import retrofit2.Call
import retrofit2.http.Body import retrofit2.http.Body
import retrofit2.http.DELETE import retrofit2.http.DELETE

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.core package dorkbox.kloudflareApi.api.core
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.core package dorkbox.kloudflareApi.api.core
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.core package dorkbox.kloudflareApi.api.core
import com.squareup.moshi.FromJson import com.squareup.moshi.FromJson
import com.squareup.moshi.ToJson import com.squareup.moshi.ToJson
import dorkbox.kloudflare.api.dns.RecordType import dorkbox.kloudflareApi.api.dns.RecordType
/** Converts byte arrays to base64 (so it looks better as a string...) */ /** Converts byte arrays to base64 (so it looks better as a string...) */
internal class DnsRecordTypeAdapter { internal class DnsRecordTypeAdapter {

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.core package dorkbox.kloudflareApi.api.core
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.core package dorkbox.kloudflareApi.api.core
import com.squareup.moshi.FromJson import com.squareup.moshi.FromJson
import com.squareup.moshi.JsonQualifier import com.squareup.moshi.JsonQualifier

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.core package dorkbox.kloudflareApi.api.core
/** /**
* https://api.cloudflare.com/#getting-started-requests * https://api.cloudflare.com/#getting-started-requests

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.core package dorkbox.kloudflareApi.api.core
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.dns package dorkbox.kloudflareApi.api.dns
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dorkbox.kloudflare.api.zone.Zone import dorkbox.kloudflareApi.api.zone.Zone
/** /**
* https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record * https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.dns package dorkbox.kloudflareApi.api.dns
/** /**
* https://api.cloudflare.com/#dns-records-for-a-zone-properties * https://api.cloudflare.com/#dns-records-for-a-zone-properties

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.dns package dorkbox.kloudflareApi.api.dns
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.dns package dorkbox.kloudflareApi.api.dns
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dorkbox.kloudflare.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import dorkbox.kloudflare.api.zone.Zone import dorkbox.kloudflareApi.api.zone.Zone
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.dns package dorkbox.kloudflareApi.api.dns
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.dns package dorkbox.kloudflareApi.api.dns
enum class RecordType { enum class RecordType {
A, AAAA, CNAME, TXT, SRV, LOC, MX, NS, SPF, CERT, DNSKEY, DS, NAPTR, SMIMEA, SSHFP, TLSA, URI A, AAAA, CNAME, TXT, SRV, LOC, MX, NS, SPF, CERT, DNSKEY, DS, NAPTR, SMIMEA, SSHFP, TLSA, URI

View File

@ -1,4 +1,4 @@
package dorkbox.kloudflare.api.dns package dorkbox.kloudflareApi.api.dns
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.firewall package dorkbox.kloudflareApi.api.firewall
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dorkbox.kloudflare.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.firewall package dorkbox.kloudflareApi.api.firewall
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.firewall package dorkbox.kloudflareApi.api.firewall
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.user package dorkbox.kloudflareApi.api.user
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dorkbox.kloudflare.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import dorkbox.kloudflare.api.zone.Zone import dorkbox.kloudflareApi.api.zone.Zone
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**

View File

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.user package dorkbox.kloudflareApi.api.user
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dorkbox.kloudflare.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**

View File

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.user package dorkbox.kloudflareApi.api.user
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dorkbox.kloudflare.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.user package dorkbox.kloudflareApi.api.user
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.user.invite package dorkbox.kloudflareApi.api.user.invite
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dorkbox.kloudflare.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.user.invite package dorkbox.kloudflareApi.api.user.invite
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.user.subscription package dorkbox.kloudflareApi.api.user.subscription
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.user.subscription package dorkbox.kloudflareApi.api.user.subscription
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.user.subscription package dorkbox.kloudflareApi.api.user.subscription
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.user.subscription package dorkbox.kloudflareApi.api.user.subscription
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dorkbox.kloudflare.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import dorkbox.kloudflare.api.zone.Zone import dorkbox.kloudflareApi.api.zone.Zone
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone package dorkbox.kloudflareApi.api.zone
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dorkbox.kloudflare.Kloudflare import dorkbox.kloudflareApi.Kloudflare
import dorkbox.kloudflare.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import dorkbox.kloudflare.api.dns.DnsRecord import dorkbox.kloudflareApi.api.dns.DnsRecord
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone.settings package dorkbox.kloudflareApi.api.zone.settings
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone.settings package dorkbox.kloudflareApi.api.zone.settings
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone.settings package dorkbox.kloudflareApi.api.zone.settings
import com.squareup.moshi.Json import com.squareup.moshi.Json

View File

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.kloudflare.api.zone.settings package dorkbox.kloudflareApi.api.zone.settings
import com.squareup.moshi.Json import com.squareup.moshi.Json
import dorkbox.kloudflare.api.core.ISO8601 import dorkbox.kloudflareApi.api.core.ISO8601
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**

View File

@ -1,7 +1,5 @@
package dorkbox.kloudflare package dorkbox.kloudflareApi
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.time.Instant import java.time.Instant
import java.util.* import java.util.*
@ -9,8 +7,6 @@ import java.util.*
* *
*/ */
object KloudflareTest { object KloudflareTest {
private val logger: Logger
init { init {
// fix logging context // fix logging context
val property = System.getProperty("logging.context") val property = System.getProperty("logging.context")
@ -19,8 +15,12 @@ object KloudflareTest {
System.setProperty("logging.context", "kloudflareAPI") System.setProperty("logging.context", "kloudflareAPI")
} }
logger = LoggerFactory.getLogger(Kloudflare::class.java) Thread.setDefaultUncaughtExceptionHandler { t, e ->
Thread.setDefaultUncaughtExceptionHandler { t, e -> logger.error("Uncaught exception in thread: '{}'", t.name, e) } run {
println("Uncaught exception in thread: '${t.name}'")
e.printStackTrace()
}
}
} }
@JvmStatic @JvmStatic
@ -31,14 +31,14 @@ object KloudflareTest {
arguments[index] = lowerCase arguments[index] = lowerCase
} }
logger.info("Starting : {} ", Instant.now().toString()) println("Starting : ${Instant.now()}")
// start up the application! // start up the application!
val jvmName = System.getProperty("java.vm.name") val jvmName = System.getProperty("java.vm.name")
val jvmVersion = System.getProperty("java.version") val jvmVersion = System.getProperty("java.version")
val jvmVendor = System.getProperty("java.vm.specification.vendor") val jvmVendor = System.getProperty("java.vm.specification.vendor")
logger.info("Execution JVM: $jvmVendor $jvmName $jvmVersion") println("Execution JVM: $jvmVendor $jvmName $jvmVersion")
logger.info("Execution arguments: ${arguments.joinToString()}") println("Execution arguments: ${arguments.joinToString()}")
val email = "user@example.com" val email = "user@example.com"