Added readme and license file
This commit is contained in:
parent
cc0f5670f3
commit
82e4c18b1a
5
LICENSE
Normal file
5
LICENSE
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
- KloudflareAPI -
|
||||||
|
https://git.dorkbox.com/dorkbox/KloudflareAPI
|
||||||
|
Copyright 2019 - The Apache Software License, Version 2.0
|
||||||
|
Dorkbox LLC
|
||||||
|
Cloudflare API v4 for Kotlin
|
72
README.md
Normal file
72
README.md
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
KloudflareAPI
|
||||||
|
=======
|
||||||
|
|
||||||
|
###### [![Dorkbox](https://badge.dorkbox.com/dorkbox.svg "Dorkbox")](https://git.dorkbox.com/dorkbox/KloudflareAPI) [![Github](https://badge.dorkbox.com/github.svg "Github")](https://github.com/dorkbox/KloudflareAPI) [![Gitlab](https://badge.dorkbox.com/gitlab.svg "Gitlab")](https://gitlab.com/dorkbox/KloudflareAPI) [![Bitbucket](https://badge.dorkbox.com/bitbucket.svg "Bitbucket")](https://bitbucket.org/dorkbox/KloudflareAPI)
|
||||||
|
|
||||||
|
|
||||||
|
KloudflareAPI is an kotlin project that implements (some of) the Cloudflare v4 API, allowing one manage DNS zones and user information
|
||||||
|
|
||||||
|
Pull requests are welcome!
|
||||||
|
|
||||||
|
- This is for cross-platform use, specifically - linux 32/64, mac 64, and windows 32/64. Java 8+
|
||||||
|
|
||||||
|
``` java
|
||||||
|
val email = "test@example.com"
|
||||||
|
val token = "ac1d3f45b51cc5d23e47aa4ac7c07b54d60f2"
|
||||||
|
|
||||||
|
val kloudflare = Kloudflare(email, token)
|
||||||
|
println(kloudflare.getUser())
|
||||||
|
|
||||||
|
val listZones = kloudflare.listZones()
|
||||||
|
listZones.forEach { zone ->
|
||||||
|
println("${zone.name} : ${zone.id}")
|
||||||
|
|
||||||
|
val dnsRecords = kloudflare.listDnsRecords(zone)
|
||||||
|
dnsRecords.forEach { dnsRecord ->
|
||||||
|
if (dnsRecord.type == RecordType.A || dnsRecord.type == RecordType.AAAA) {
|
||||||
|
val domainLength = zone.name.length
|
||||||
|
val length = dnsRecord.name.length - domainLength
|
||||||
|
|
||||||
|
val domainName = if (length == 0) {
|
||||||
|
"@"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// -1 because we don't want the '.'
|
||||||
|
dnsRecord.name.subSequence(0, length - 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
println(" $domainName ${dnsRecord.type} : ${dnsRecord.id}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Maven Info
|
||||||
|
---------
|
||||||
|
```
|
||||||
|
<dependencies>
|
||||||
|
...
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.dorkbox</groupId>
|
||||||
|
<artifactId>KloudflareAPI</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
```
|
||||||
|
|
||||||
|
Gradle Info
|
||||||
|
---------
|
||||||
|
````
|
||||||
|
dependencies {
|
||||||
|
...
|
||||||
|
compile 'com.dorkbox:KloudflareAPI:1.0'
|
||||||
|
}
|
||||||
|
````
|
||||||
|
|
||||||
|
License
|
||||||
|
---------
|
||||||
|
This project is © 2019 dorkbox llc, and is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further references.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user