tomsiewert / hetznercloud-java Goto Github PK
View Code? Open in Web Editor NEWJava Library for the Hetzner Cloud API
Home Page: https://tomsiewert.github.io/hetznercloud-java
License: MIT License
Java Library for the Hetzner Cloud API
Home Page: https://tomsiewert.github.io/hetznercloud-java
License: MIT License
According to the Hetzner Cloud API documentation, these two API error codes are missing.
[unavailable, unauthorized]
I did also make a PR (#207), hope get merged soon
Currently the link from your README to your JavaDocs seems to be broken or the host is down: https://docs.hcloud.siewert.io/
The Hetzner Cloud API definition defines quite a few request parameters that are optional.
Currently it is unclear how one can define such a parameter as "not set".
Should it be set to null
? Are there parameters where the meaning of null
differs from not set
?
Ideally the fact whether a parameter is optional or not would be expressed through the type system, e.g. via something like Java 8's Optional type.
Hi, im Wiki auf der Seite:
https://github.com/TomSDEVSN/hetznercloud-java/wiki/Create-Server
Haben die Objekte falsche Namen:
RequestServer requestServer = RequestServer.builder()
Es mรผsste mehr so aussehen:
ServerRequest requestServer = ServerRequest.builder()
Currently you've to write the server types with lower case or you'll get an Exception (HTTP 422)
Hello,
Really appreciate the work done with this project, thank you!!
A useful addition to this library would be if Hetzner DNS support was added. Documentation: https://dns.hetzner.com/api-docs
Do you accept PRs? Could be done in a fork and contributed back to this project, if you wish.
The method
is private and can therefore not be accessed.I think it should be public.
Is it planned to support the Network feature in the near future?
https://docs.hetzner.cloud/#networks
May I can help to implement that...
Thanks for the excellent work of supporting Hetzner API with Java.
The current jar in maven central seems to be a shaded jar, which has compatibility issues with latest Spring Boot (I'm using Spring Boot 2.4.1):
2020-12-21 11:09:52.688 ERROR 82796 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.context.support.GenericApplicationContext.setApplicationStartup(GenericApplicationContext.java:165)
The following method did not exist:
'void org.springframework.beans.factory.support.DefaultListableBeanFactory.setApplicationStartup(org.springframework.core.metrics.ApplicationStartup)'
The method's class, org.springframework.beans.factory.support.DefaultListableBeanFactory, is available from the following locations:
jar:file:/Users/zhb/.gradle/caches/modules-2/files-2.1/me.tomsdevsn/hetznercloud-api/2.11.0/b6dc04414fc5070ad48b7c8350d5aabaa0cf6b08/hetznercloud-api-2.11.0.jar!/org/springframework/beans/factory/support/DefaultListableBeanFactory.class
jar:file:/Users/zhb/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/5.3.2/289d8047f7cc524d60ca0c4cc6fedb8cb003e02d/spring-beans-5.3.2.jar!/org/springframework/beans/factory/support/DefaultListableBeanFactory.class
The class hierarchy was loaded from the following locations:
org.springframework.beans.factory.support.DefaultListableBeanFactory: file:/Users/zhb/.gradle/caches/modules-2/files-2.1/me.tomsdevsn/hetznercloud-api/2.11.0/b6dc04414fc5070ad48b7c8350d5aabaa0cf6b08/hetznercloud-api-2.11.0.jar
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory: file:/Users/zhb/.gradle/caches/modules-2/files-2.1/me.tomsdevsn/hetznercloud-api/2.11.0/b6dc04414fc5070ad48b7c8350d5aabaa0cf6b08/hetznercloud-api-2.11.0.jar
org.springframework.beans.factory.support.AbstractBeanFactory: file:/Users/zhb/.gradle/caches/modules-2/files-2.1/me.tomsdevsn/hetznercloud-api/2.11.0/b6dc04414fc5070ad48b7c8350d5aabaa0cf6b08/hetznercloud-api-2.11.0.jar
org.springframework.beans.factory.support.FactoryBeanRegistrySupport: file:/Users/zhb/.gradle/caches/modules-2/files-2.1/me.tomsdevsn/hetznercloud-api/2.11.0/b6dc04414fc5070ad48b7c8350d5aabaa0cf6b08/hetznercloud-api-2.11.0.jar
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry: file:/Users/zhb/.gradle/caches/modules-2/files-2.1/me.tomsdevsn/hetznercloud-api/2.11.0/b6dc04414fc5070ad48b7c8350d5aabaa0cf6b08/hetznercloud-api-2.11.0.jar
org.springframework.core.SimpleAliasRegistry: file:/Users/zhb/.gradle/caches/modules-2/files-2.1/me.tomsdevsn/hetznercloud-api/2.11.0/b6dc04414fc5070ad48b7c8350d5aabaa0cf6b08/hetznercloud-api-2.11.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.beans.factory.support.DefaultListableBeanFactory
It's clear that the shaded spring packages conflicts. I can't even exclude it because it's shaded inside that jar. I assume the shaded jar is necessary in some scenario, but this makes it impossible to integrate with latest Spring Boot application.
Hey, I try to use ImagesResponse Class, but as the member is private, it is unusable for forther processing (except converting to string)....
Is it possible to add a getter for the images member?
I see that after every merge you have to manually make changes in 3-4 files and push manually. This can be automated. Can you try following the links to add a github workflow which automatically increments the version and commits to the repo with a message [skip-ci-version-bump] so that it does not infinitely trigger version increments. Some sample links to check.
OkHttp 4.x has no support for Happy Eyeballs and breaks in environments with funky IPv6 however, the HC API got IPv6 support some time ago.
OkHttp 5 alpha has Happy Eyeballs support and some sort of working failover between IPv6 and IPv4.
Check what effort it'd be to migrate to OkHttp 5 and what could break. Also, do we want to use an alpha version for a production release?
I need to configure the OkHttpClient instance inside the HetznerCloudAPI
tl;dr what it should contain:
Current implementation seems only able to fetch the data at first page, which is 25 by default. The entire /servers
response:
{
"servers": [
{
"id": 9290830,
"name": "ubuntu-2004-base",
},
...
],
"meta": {
"pagination": {
"page": 1,
"per_page": 25,
"previous_page": null,
"next_page": 2,
"last_page": 9,
"total_entries": 205
}
}
}
I am encountering issues while trying to use this library from an android app .
Calling HetznerCloudApi.getSSHKeys results in a RuntimeException caused by an EOFException.
Is this API not android compatible?
Currently accessibility of model class fields is not consistent.
E.g. Servers#servers
, ResponseSSHKeys#sshKeys
and ResponseServerTypes#serverTypes
are private
, while ResponseImages#images
and ResponseISOS#isos
are public
.
IMHO the library should pick one style and consistently use it across all types.
Additionally, and depending on the constraints of the serialization magic in use (that I am not familiar with), I would suggest that all data classes become as immutable as possible, i.e.:
final
final
@NonNull
unless null
is explicitly allowed by the API (e.g. for optional fields?)I observed this flaky error:
Caused by: java.lang.NumberFormatException: multiple points
at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1914)
at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.base/java.lang.Double.parseDouble(Double.java:543)
at java.base/java.text.DigitList.getDouble(DigitList.java:169)
at java.base/java.text.DecimalFormat.parse(DecimalFormat.java:2126)
at java.base/java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1933)
at java.base/java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1541)
at java.base/java.text.DateFormat.parse(DateFormat.java:393)
at me.tomsdevsn.hetznercloud.deserialize.DateDeserializer.deserialize(DateDeserializer.java:29)
at me.tomsdevsn.hetznercloud.deserialize.DateDeserializer.deserialize(DateDeserializer.java:12)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:371)
According to https://medium.com/@daveford/numberformatexception-multiple-points-when-parsing-date-650baa6829b6 , https://github.com/TomSDEVSN/hetznercloud-java/blob/ab8f9c8a9f175dc52fc3db424df220b76848b30b/src/main/java/me/tomsdevsn/hetznercloud/deserialize/DateDeserializer.java contains a private SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
, which is not thread-safe. We should either make it local variable or threadlocalized.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
.github/workflows/build.yml
actions/checkout v4
actions/setup-java v4
.github/workflows/codeql.yml
actions/checkout v4
github/codeql-action v3
github/codeql-action v3
github/codeql-action v3
.github/workflows/release.yml
actions/checkout v4
actions/setup-java v4
crazy-max/ghaction-import-gpg v6
softprops/action-gh-release v2
actions/checkout v4
actions/setup-java v4
JamesIves/github-pages-deploy-action v4.5.0
.github/workflows/test.yml
actions/checkout v4
actions/setup-java v4
pom.xml
com.squareup.okhttp3:okhttp 4.12.0
com.fasterxml.jackson.core:jackson-databind 2.17.0
org.projectlombok:lombok 1.18.32
org.assertj:assertj-core 3.25.3
org.junit.jupiter:junit-jupiter 5.10.2
org.slf4j:slf4j-simple 2.0.12
org.awaitility:awaitility 4.2.1
org.apache.jclouds:jclouds-compute 2.6.0
org.bouncycastle:bcpkix-jdk15on 1.70
org.apache.maven.plugins:maven-compiler-plugin 3.12.1
org.apache.maven.plugins:maven-surefire-plugin 3.2.5
org.apache.maven.plugins:maven-source-plugin 3.2.1
org.apache.maven.plugins:maven-javadoc-plugin 3.6.3
org.apache.maven.plugins:maven-deploy-plugin 3.1.1
org.apache.maven.plugins:maven-release-plugin 3.0.1
org.apache.maven.scm:maven-scm-provider-gitexe 2.0.1
org.sonatype.plugins:nexus-staging-maven-plugin 1.6.13
org.apache.maven.plugins:maven-gpg-plugin 3.1.0
org.apache.maven.plugins:maven-checkstyle-plugin 3.3.1
com.puppycrawl.tools:checkstyle 10.14.2
In the readme, a link to javadoc is referenced, but when opening (https://docs.hcloud.siewert.io/) you get: There isn't a GitHub Pages site here.
Would be great to have a working link for browsing the javadoc online :)
Implementation for Private networking needed.
It'd be great if hetznercloud-java
was available through maven central and thus did not require local building and publishing...
Got exceptions when creating new servers:
java.util.concurrent.ExecutionException: org.springframework.web.client.RestClientException: Error while extracting response for type [class me.tomsdevsn.hetznercloud.objects.response.ServerResponse] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: For input string: "202002E.4202002E4"; nested exception is com.fasterxml.jackson.databind.JsonMappingException: For input string: "202002E.4202002E4" (through reference chain: me.tomsdevsn.hetznercloud.objects.response.ServerResponse["server"]->me.tomsdevsn.hetznercloud.objects.general.Server["image"]->me.tomsdevsn.hetznercloud.objects.general.Image["created"])
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.gradle.hetznerautoscaler.TestDistributionAgentPool.startMachines(HetznerAutoscalerApplication.kt:101)
at org.gradle.hetznerautoscaler.TestDistributionAgentPool.makeSureAgentPoolMatchesWorkload(HetznerAutoscalerApplication.kt:70)
at org.gradle.hetznerautoscaler.EveryMinuteTask.minuteTask(HetznerAutoscalerApplication.kt:47)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:95)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.springframework.web.client.RestClientException: Error while extracting response for type [class me.tomsdevsn.hetznercloud.objects.response.ServerResponse] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: For input string: "202002E.4202002E4"; nested exception is com.fasterxml.jackson.databind.JsonMappingException: For input string: "202002E.4202002E4" (through reference chain: me.tomsdevsn.hetznercloud.objects.response.ServerResponse["server"]->me.tomsdevsn.hetznercloud.objects.general.Server["image"]->me.tomsdevsn.hetznercloud.objects.general.Image["created"])
at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:120)
at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:1034)
at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:1017)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:777)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:710)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:467)
at me.tomsdevsn.hetznercloud.HetznerCloudAPI.createServer(HetznerCloudAPI.java:113)
at org.gradle.hetznerautoscaler.DefaultHetznerCloudClient.startServer(HetznerCloudClient.kt:37)
at org.gradle.hetznerautoscaler.TestDistributionAgentPool$startMachines$$inlined$List$lambda$1.run(HetznerAutoscalerApplication.kt:97)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
... 3 common frames omitted
It seems like that Image.CreatedFrom.id
should be String
instead of Long
: https://github.com/blindpirate/hetznercloud-java/blob/8edd4c91bd01e770875b93e0bedb50a1a14c5a07/src/main/java/me/tomsdevsn/hetznercloud/objects/general/Image.java#L44
There is no implementation of "created" flag in Floating IPs.
Most of you have already seen from the commits, as well as from the time I needed for the issues, that the project here is relatively unmaintained from my side. I would like to explain why this is so, as the client is used more than I thought.
I started the project when I was still in school and had a lot of free time. I spent this free time, besides friends and family, almost exclusively with Java.
Since I started my apprenticeship at Hetzner, the contact with Java has decreased, because we don't use this language internally, as well as my available free time. I concentrate more on my work and the training itself, as well as I try to use my little free time as much as possible, but with friends and family instead of with an IDE.
However, when I do some programming, I do it in languages like Golang or Ruby. Java is rarely used here, mostly only through vocational school.
I would not like to drop this project, as it is (apparently) the only Java client that is largely well maintained (even if everything takes some time to implement).
I would also like to point out that I am happy to accept help from anyone, be it as PR or as a simple issue.
Thank you for your understanding.
Hey, would you be ok with replacing Spring with a more lightweight HTTP only library (e.g. OkHttp)?
Currently only the Resttemplate is used from Spring, which in my opinion drags in a lot of complexity and dependencies just to execute some basic HTTP requests. Spring, being a fairly complex piece of software with a lot of dependencies also greatly increases the attack surface (see CVEs for currently used version) and makes usage in a Spring application potentially harder.
Originally posted by @pellepelster in #45 (comment)
shade plugin should not be used to compile libraries used by other maven projects ,
not shading the library allows excluding the library dependencies if required , for example if the library is using Jackson version 2.9.10.5
another project using the library may exclude the library's Jackson dependency and use its own.
Currently it seems that if you create a server without a SSH key, it will throw an Exception because no SSH key is given.
That wo be fixed in version 2.5.1
Currently the request and response model types are named as RequestXXX
and ResponseXXX
which is not in line with Java naming conventions.
Usually type names end with the basic name and are prefixed with qualifiers.
E.g. a ServerRequest
is a first and foremost a request. The prefix Server
qualifies it and says that is a Request
for a Server
. The same logic applies to responses.
Therefore all the types should really be named the other way around, i.e. XXXRequest
and XXXResponse
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.