8 Commits

Author SHA1 Message Date
thischwa 83ad5d7fe8 [maven-release-plugin] prepare release v0.1.0-beta.2 2025-04-13 19:33:58 +02:00
thischwa 9e3e12a08b Refactor constructor to explicitly throw IllegalArgumentException
Updated the constructor in CfBasicHttpClient to include explicit throws for IllegalArgumentException. This enhances clarity and ensures the method signature reflects the potential for exceptions. Minor formatting adjustments were also made for improved code readability.
2025-04-13 19:27:21 +02:00
thischwa 34ea8e1b62 fixed issue #3 2025-04-13 17:33:50 +02:00
thischwa f5ba156c49 Update Javadoc link and remove outdated documentation
Replaced the Javadoc link in the README with the updated URL and deleted the obsolete `docs/README.MD` file. This ensures that the documentation points to the correct and current resources.
2025-04-13 09:51:08 +02:00
thischwa 99939ed591 Add GitLab Pages deployment to CI configuration
This update introduces a new job to deploy GitLab Pages. The job copies content from the `docs/` directory to the `public/` directory and is triggered only on the `develop` branch.
2025-04-13 09:42:28 +02:00
thischwa 49a1d51ce8 Update version format in README dependency example
Corrected the version format to match standard semantic versioning. This ensures consistency and avoids potential confusion for users copying the dependency snippet.
2025-04-12 20:22:03 +02:00
thischwa 694965d6ec Update version format in README dependency example
Corrected the version format to match standard semantic versioning. This ensures consistency and avoids potential confusion for users copying the dependency snippet.
2025-04-12 19:35:47 +02:00
thischwa c4e5a3e6e5 [maven-release-plugin] prepare for next development iteration 2025-04-12 19:29:51 +02:00
7 changed files with 38 additions and 26 deletions
+12
View File
@@ -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
+3 -5
View File
@@ -1,6 +1,6 @@
# CloudflareDNS-java # CloudflareDNS-java
[![Build and Test](https://github.com/th-schwarz/CloudflareDNS-java/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/th-schwarz/CloudflareDNS-java/actions/workflows/build-and-test.yml) ![GitHub License](https://img.shields.io/github/license/th-schwarz/CloudflareDNS-java) ![GitLab Pipeline Status](https://gitlab.com/thischwa/CloudflareDNS-java/badges/develop/pipeline.svg)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=thischwa_CloudflareDNS-java&metric=alert_status&token=1e0791f87b2eb3b9783c2ae7de08dbf724ea15f5)](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=thischwa_CloudflareDNS-java&metric=alert_status&token=1e0791f87b2eb3b9783c2ae7de08dbf724ea15f5)](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=thischwa_CloudflareDNS-java&metric=security_rating&token=1e0791f87b2eb3b9783c2ae7de08dbf724ea15f5)](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=thischwa_CloudflareDNS-java&metric=security_rating&token=1e0791f87b2eb3b9783c2ae7de08dbf724ea15f5)](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java)
@@ -8,8 +8,6 @@
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=thischwa_CloudflareDNS-java&metric=ncloc&token=1e0791f87b2eb3b9783c2ae7de08dbf724ea15f5)](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=thischwa_CloudflareDNS-java&metric=ncloc&token=1e0791f87b2eb3b9783c2ae7de08dbf724ea15f5)](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=thischwa_CloudflareDNS-java&metric=code_smells&token=1e0791f87b2eb3b9783c2ae7de08dbf724ea15f5)](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=thischwa_CloudflareDNS-java&metric=code_smells&token=1e0791f87b2eb3b9783c2ae7de08dbf724ea15f5)](https://sonarcloud.io/summary/new_code?id=thischwa_CloudflareDNS-java)
Give it a try! [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/th-schwarz/CloudflareDNS-java?include_prereleases)](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`
-3
View File
@@ -1,3 +0,0 @@
# Documents for CloudflareDNS-java
- [api](apidocs/index.html)
+2 -2
View File
@@ -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 {