Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 83ad5d7fe8 | |||
| 9e3e12a08b | |||
| 34ea8e1b62 | |||
| f5ba156c49 | |||
| 99939ed591 | |||
| 49a1d51ce8 | |||
| 694965d6ec | |||
| c4e5a3e6e5 |
@@ -60,3 +60,15 @@ sonarcloud_scan:
|
|||||||
only:
|
only:
|
||||||
- merge_requests
|
- merge_requests
|
||||||
- develop
|
- 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
|
# 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)
|
||||||
[](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)
|
||||||
[](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
|
## 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.
|
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>
|
<dependency>
|
||||||
<groupId>codes.thischwa</groupId>
|
<groupId>codes.thischwa</groupId>
|
||||||
<artifactId>cloudflaredns</artifactId>
|
<artifactId>cloudflaredns</artifactId>
|
||||||
<version>0.1.0.beta-2</version>
|
<version>0.1.0-beta.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Methods Overview
|
## 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`
|
### Instantiation of `CfDnsClient`
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# Documents for CloudflareDNS-java
|
|
||||||
|
|
||||||
- [api](apidocs/index.html)
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<groupId>codes.thischwa</groupId>
|
<groupId>codes.thischwa</groupId>
|
||||||
<artifactId>cloudflaredns</artifactId>
|
<artifactId>cloudflaredns</artifactId>
|
||||||
<version>0.1.0-beta.1</version>
|
<version>0.1.0-beta.2</version>
|
||||||
<name>CloudflareDNS-java</name>
|
<name>CloudflareDNS-java</name>
|
||||||
<inceptionYear>2025</inceptionYear>
|
<inceptionYear>2025</inceptionYear>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<developerConnection>scm:git:git@gitlab.com:thischwa/CloudflareDNS-java.git</developerConnection>
|
<developerConnection>scm:git:git@gitlab.com:thischwa/CloudflareDNS-java.git</developerConnection>
|
||||||
<connection>scm:git:git@gitlab.com:thischwa/CloudflareDNS-java.git</connection>
|
<connection>scm:git:git@gitlab.com:thischwa/CloudflareDNS-java.git</connection>
|
||||||
<url>https://gitlab.com/thischwa/CloudflareDNS-java</url>
|
<url>https://gitlab.com/thischwa/CloudflareDNS-java</url>
|
||||||
<tag>v0.1.0-beta.1</tag>
|
<tag>v0.1.0-beta.2</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
|
|||||||
@@ -35,15 +35,26 @@ abstract class CfBasicHttpClient {
|
|||||||
private final String baseUrl;
|
private final String baseUrl;
|
||||||
private final String authEmail;
|
private final String authEmail;
|
||||||
private final String authKey;
|
private final String authKey;
|
||||||
private final String authToken;
|
|
||||||
|
|
||||||
private final ObjectMapper objectMapper;
|
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.baseUrl = baseUrl;
|
||||||
this.authEmail = authEmail;
|
this.authEmail = authEmail;
|
||||||
this.authKey = authKey;
|
this.authKey = authKey;
|
||||||
this.authToken = authToken;
|
|
||||||
this.objectMapper = initObjectMapper();
|
this.objectMapper = initObjectMapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +78,6 @@ abstract class CfBasicHttpClient {
|
|||||||
HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
|
HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
|
||||||
request.addHeader("X-Auth-Email", authEmail);
|
request.addHeader("X-Auth-Email", authEmail);
|
||||||
request.addHeader("X-Auth-Key", authKey);
|
request.addHeader("X-Auth-Key", authKey);
|
||||||
request.addHeader("X-Auth-Token", authToken);
|
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,10 +53,9 @@ public class CfDnsClient extends CfBasicHttpClient {
|
|||||||
* authentication.
|
* authentication.
|
||||||
* @param authKey The API key of the Cloudflare account, used as part of the authentication
|
* @param authKey The API key of the Cloudflare account, used as part of the authentication
|
||||||
* process.
|
* process.
|
||||||
* @param authToken The API token for accessing specific resources within the Cloudflare account.
|
|
||||||
*/
|
*/
|
||||||
public CfDnsClient(String authEmail, String authKey, String authToken) {
|
public CfDnsClient(String authEmail, String authKey) {
|
||||||
this(DEFAULT_BASEURL, authEmail, authKey, authToken);
|
this(DEFAULT_BASEURL, authEmail, authKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,10 +66,9 @@ public class CfDnsClient extends CfBasicHttpClient {
|
|||||||
* authentication.
|
* authentication.
|
||||||
* @param authKey The API key of the Cloudflare account, used as part of the authentication
|
* @param authKey The API key of the Cloudflare account, used as part of the authentication
|
||||||
* process.
|
* process.
|
||||||
* @param authToken The API token for accessing specific resources within the Cloudflare account.
|
|
||||||
*/
|
*/
|
||||||
public CfDnsClient(String baseUrl, String authEmail, String authKey, String authToken) {
|
public CfDnsClient(String baseUrl, String authEmail, String authKey) {
|
||||||
this(true, baseUrl, authEmail, authKey, authToken);
|
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 baseUrl The base URL for the Cloudflare API endpoint.
|
||||||
* @param authEmail The email associated with the Cloudflare account for authentication.
|
* @param authEmail The email associated with the Cloudflare account for authentication.
|
||||||
* @param authKey The API key for authenticating the client with Cloudflare services.
|
* @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(
|
public CfDnsClient(
|
||||||
boolean emptyResultThrowsException,
|
boolean emptyResultThrowsException,
|
||||||
String baseUrl,
|
String baseUrl,
|
||||||
String authEmail,
|
String authEmail,
|
||||||
String authKey,
|
String authKey) {
|
||||||
String authToken) {
|
super(baseUrl, authEmail, authKey);
|
||||||
super(baseUrl, authEmail, authKey, authToken);
|
|
||||||
this.emptyResultThrowsException = emptyResultThrowsException;
|
this.emptyResultThrowsException = emptyResultThrowsException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,8 @@ public class CfClientTest {
|
|||||||
|
|
||||||
private final String email = System.getenv("API_EMAIL");
|
private final String email = System.getenv("API_EMAIL");
|
||||||
private final String apiKey = System.getenv("API_KEY");
|
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
|
@Test
|
||||||
void testList() throws Exception {
|
void testList() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user