Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 83ad5d7fe8 | |||
| 9e3e12a08b | |||
| 34ea8e1b62 | |||
| f5ba156c49 | |||
| 99939ed591 | |||
| 49a1d51ce8 | |||
| 694965d6ec | |||
| c4e5a3e6e5 |
@@ -60,3 +60,15 @@ sonarcloud_scan:
|
||||
only:
|
||||
- merge_requests
|
||||
- develop
|
||||
|
||||
pages:
|
||||
stage: on_commit
|
||||
script:
|
||||
- echo "Deploying GitLab Pages from docs/"
|
||||
- mkdir public
|
||||
- cp -r docs/* public/
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- develop
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# CloudflareDNS-java
|
||||
|
||||
[](https://github.com/th-schwarz/CloudflareDNS-java/actions/workflows/build-and-test.yml) 
|
||||

|
||||
|
||||
[](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java)
|
||||
[](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java)
|
||||
@@ -8,8 +8,6 @@
|
||||
[](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java)
|
||||
[](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java)
|
||||
|
||||
Give it a try! [](https://github.com/th-schwarz/CloudflareDNS-java/releases)
|
||||
|
||||
## Preface
|
||||
|
||||
This project provides a java client for minimalistic access to the Cloudflare API, which is mainly used for managing DNS settings such as creating, updating and deleting DNS records.
|
||||
@@ -49,13 +47,13 @@ The dependency is:
|
||||
<dependency>
|
||||
<groupId>codes.thischwa</groupId>
|
||||
<artifactId>cloudflaredns</artifactId>
|
||||
<version>0.1.0.beta-2</version>
|
||||
<version>0.1.0-beta.1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## Methods Overview
|
||||
|
||||
The following text focuses on the basic methods. For further information take a look at the [javadoc of the CfDnsClient](https://th-schwarz.github.io/CloudflareDNS-java/apidocs/codes/thischwa/cf/CfDnsClient.html).
|
||||
The following text focuses on the basic methods. For further information take a look at the [javadoc of the CfDnsClient](https://cloudflaredns-java-f4ee3a.gitlab.io/apidocs/codes/thischwa/cf/CfDnsClient.html).
|
||||
|
||||
### Instantiation of `CfDnsClient`
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# Documents for CloudflareDNS-java
|
||||
|
||||
- [api](apidocs/index.html)
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>codes.thischwa</groupId>
|
||||
<artifactId>cloudflaredns</artifactId>
|
||||
<version>0.1.0-beta.1</version>
|
||||
<version>0.1.0-beta.2</version>
|
||||
<name>CloudflareDNS-java</name>
|
||||
<inceptionYear>2025</inceptionYear>
|
||||
<packaging>jar</packaging>
|
||||
@@ -43,7 +43,7 @@
|
||||
<developerConnection>scm:git:git@gitlab.com:thischwa/CloudflareDNS-java.git</developerConnection>
|
||||
<connection>scm:git:git@gitlab.com:thischwa/CloudflareDNS-java.git</connection>
|
||||
<url>https://gitlab.com/thischwa/CloudflareDNS-java</url>
|
||||
<tag>v0.1.0-beta.1</tag>
|
||||
<tag>v0.1.0-beta.2</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
|
||||
@@ -35,15 +35,26 @@ abstract class CfBasicHttpClient {
|
||||
private final String baseUrl;
|
||||
private final String authEmail;
|
||||
private final String authKey;
|
||||
private final String authToken;
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
CfBasicHttpClient(String baseUrl, String authEmail, String authKey, String authToken) {
|
||||
CfBasicHttpClient(String baseUrl, String authEmail, String authKey) throws IllegalArgumentException
|
||||
{
|
||||
if (baseUrl == null || baseUrl.isBlank())
|
||||
{
|
||||
throw new IllegalArgumentException("Base URL must not be null or blank!");
|
||||
}
|
||||
if (authEmail == null || authEmail.isBlank())
|
||||
{
|
||||
throw new IllegalArgumentException("Authentication email must not be null or blank!");
|
||||
}
|
||||
if (authKey == null || authKey.isBlank())
|
||||
{
|
||||
throw new IllegalArgumentException("Authentication key must not be null or blank!");
|
||||
}
|
||||
this.baseUrl = baseUrl;
|
||||
this.authEmail = authEmail;
|
||||
this.authKey = authKey;
|
||||
this.authToken = authToken;
|
||||
this.objectMapper = initObjectMapper();
|
||||
}
|
||||
|
||||
@@ -67,7 +78,6 @@ abstract class CfBasicHttpClient {
|
||||
HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
|
||||
request.addHeader("X-Auth-Email", authEmail);
|
||||
request.addHeader("X-Auth-Key", authKey);
|
||||
request.addHeader("X-Auth-Token", authToken);
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -53,10 +53,9 @@ public class CfDnsClient extends CfBasicHttpClient {
|
||||
* authentication.
|
||||
* @param authKey The API key of the Cloudflare account, used as part of the authentication
|
||||
* process.
|
||||
* @param authToken The API token for accessing specific resources within the Cloudflare account.
|
||||
*/
|
||||
public CfDnsClient(String authEmail, String authKey, String authToken) {
|
||||
this(DEFAULT_BASEURL, authEmail, authKey, authToken);
|
||||
public CfDnsClient(String authEmail, String authKey) {
|
||||
this(DEFAULT_BASEURL, authEmail, authKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,10 +66,9 @@ public class CfDnsClient extends CfBasicHttpClient {
|
||||
* authentication.
|
||||
* @param authKey The API key of the Cloudflare account, used as part of the authentication
|
||||
* process.
|
||||
* @param authToken The API token for accessing specific resources within the Cloudflare account.
|
||||
*/
|
||||
public CfDnsClient(String baseUrl, String authEmail, String authKey, String authToken) {
|
||||
this(true, baseUrl, authEmail, authKey, authToken);
|
||||
public CfDnsClient(String baseUrl, String authEmail, String authKey) {
|
||||
this(true, baseUrl, authEmail, authKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,15 +80,13 @@ public class CfDnsClient extends CfBasicHttpClient {
|
||||
* @param baseUrl The base URL for the Cloudflare API endpoint.
|
||||
* @param authEmail The email associated with the Cloudflare account for authentication.
|
||||
* @param authKey The API key for authenticating the client with Cloudflare services.
|
||||
* @param authToken The authentication token used for authorized access to Cloudflare API.
|
||||
*/
|
||||
public CfDnsClient(
|
||||
boolean emptyResultThrowsException,
|
||||
String baseUrl,
|
||||
String authEmail,
|
||||
String authKey,
|
||||
String authToken) {
|
||||
super(baseUrl, authEmail, authKey, authToken);
|
||||
String authKey) {
|
||||
super(baseUrl, authEmail, authKey);
|
||||
this.emptyResultThrowsException = emptyResultThrowsException;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,8 @@ public class CfClientTest {
|
||||
|
||||
private final String email = System.getenv("API_EMAIL");
|
||||
private final String apiKey = System.getenv("API_KEY");
|
||||
private final String apiToken = System.getenv("API_TOKEN");
|
||||
|
||||
private final CfDnsClient client = new CfDnsClient(email, apiKey, apiToken);
|
||||
private final CfDnsClient client = new CfDnsClient(email, apiKey);
|
||||
|
||||
@Test
|
||||
void testList() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user