public class HetznerCloudAPI
extends java.lang.Object
| Constructor and Description |
|---|
HetznerCloudAPI(java.lang.String token)
Initial method to use the API
|
| Modifier and Type | Method and Description |
|---|---|
ResponseAction |
assignFloatingIP(long id,
RequestAssignFloatingIP requestAssignFloatingIP)
Assign a Floating IP to a server
|
ResponseAction |
attachISO(long id,
RequestAttachISO requestAttachISO)
Attach an ISO to a server.
|
ResponseGetFloatingIP |
changeDescriptionOfFloatingIP(long id,
RequestDescriptionFloatingIP requestDescriptionFloatingIP)
Change the description of a Floating IP.
|
ResponseAction |
changeDNSPTR(long id,
RequestChangeReverseDNS requestChangeReverseDNS)
Changes the reverse DNS entry from a server.
|
ResponseAction |
changeFloatingReverseDNS(long id,
RequestChangeReverseDNS requestChangeReverseDNS)
Change the reverse DNS entry for a Floating IP
|
ResponseServernameChange |
changeServerName(long id,
RequestServernameChange newServerName)
Change the name of the server, in the Hetzner-Cloud Console
|
ResponseAction |
changeServerType(long id,
RequestChangeType requestChangeType)
Change the type from the server
|
ResponseSSHKey |
changeSSHKeyName(long id,
RequestChangeSSHKeyName requestChangeSSHKeyName)
Change the name of a SSH key
|
java.lang.String |
convertToISO8601(java.util.Date date)
Converts a Date to the ISO-8601 format
|
ResponseFloatingIP |
createFloatingIP(RequestFloatingIP requestFloatingIP)
Create a Floating IP for the project or for a Server.
|
ResponseCreateImage |
createImage(long id,
RequestCreateImage requestCreateImage)
Create a image from a server
|
ResponseServer |
createServer(RequestServer requestServer)
Creates a Cloud-server
|
ResponseSSHKey |
createSSHKey(RequestSSHKey requestSSHKey)
Create a SSH key.
|
java.lang.String |
deleteFloatingIP(long id)
Delete a Floating IP.
|
java.lang.String |
deleteImage(long id)
Delete an image,
|
ResponseAction |
deleteServer(long id)
Delete a server instantly.
|
java.lang.String |
deleteSSHKey(long id)
Delete a SSH key.
|
ResponseAction |
detachISO(long id)
Detach an ISO from a server.
|
ResponseDisableBackup |
disableBackup(long id)
Disable the backups from a server
|
ResponseAction |
disableRescue(long id)
Disables the rescue mode from the server.
|
ResponseEnableBackup |
enableBackup(long id,
RequestEnableBackup requestEnableBackup)
Enable the backups from a server
|
ResponseEnableRescue |
enableRescue(long id)
Enables the rescue mode from the server
|
ResponseEnableRescue |
enableRescue(long id,
RequestEnableRescue requestEnableRescue)
Enables the rescue mode from the server
|
ResponseEnableRescue |
enableRescueAndReset(long id)
Enables the rescue mode from the server and reset the server
|
ResponseEnableRescue |
enableRescueAndReset(long id,
RequestEnableRescue requestEnableRescue)
Enables the rescue mode from the server and reset the server
|
ResponseAction |
getActionOfFloatingIP(long floatingIPID,
long actionID)
Get a Action for a server
|
ResponseAction |
getActionOfServer(long serverID,
long actionID)
Get a Action for a server
|
ResponseActions |
getActionsOfFloatingIP(long id)
Get all performed Actions of a Floating IP
|
ResponseActions |
getAllActionsOfServer(long id)
Get all performed Actions for a Server
|
ResponseDatacenter |
getDatacenter(long id)
Get a Datacenter by ID
|
ResponseDatacenters |
getDatacenter(java.lang.String name)
Get a datacenter by name
|
ResponseDatacenters |
getDatacenters()
Get all available datacenters and the recommendation
|
ResponseGetFloatingIP |
getFloatingIP(long id)
Get a specific Floating IP.
|
ResponseFloatingIPs |
getFloatingIPs()
Get all Floating IP's in a object
|
ResponseImage |
getImage(long id)
Get image by ID.
|
ResponseImages |
getImageByName(java.lang.String name)
Get an image by name.
|
ResponseImages |
getImages()
Get all available ResponseImages
|
ResponseImages |
getImages(ImageType type)
Get all images by type.
|
ResponseISO |
getISOById(long id)
Get an ISO by ID
|
ResponseISOS |
getISOS()
Get all available ISO's.
|
ResponseLocation |
getLocation(long id)
Get a location;
|
ResponseLocations |
getLocationByName(java.lang.String name)
Get a Location by name.
|
ResponseLocations |
getLocations()
Get all available Locations.
|
ResponseMetrics |
getMetrics(long id,
java.lang.String metricType,
java.lang.String start,
java.lang.String end)
Get the metrics from a server
|
ResponsePricing |
getPricing()
Get all prices from the products
|
ResponseGetServer |
getServerById(long id)
Get the server by the server-id
|
Servers |
getServerByName(java.lang.String name)
Get the server by the name
|
Servers |
getServers()
Get all of your servers in a list
|
ResponseServerType |
getServerType(long id)
Create a SSH key.
|
ResponseServerTypes |
getServerTypeByName(java.lang.String name)
Get a Server type by name.
|
ResponseServerTypes |
getServerTypes()
Get all Server types.
|
ResponseSSHKey |
getSSHKey(long id)
Get a SSH key by ID.
|
ResponseSSHKeys |
getSSHKeyByName(java.lang.String name)
Get a SSH key by name.
|
ResponseSSHKeys |
getSSHKeys()
Get all SSH keys.
|
ResponseAction |
powerOffServer(long id)
Force power off a specific server with the id
|
ResponseAction |
powerOnServer(long id)
Power on a specific server with the id
|
ResponseRebuildServer |
rebuildServer(long id,
RequestRebuildServer requestRebuildServer)
Rebuild a server, with the specific image.
|
ResponseConsole |
requestConsole(long id)
Request a VNC over websocket Console
|
ResponseResetPassword |
resetRootPassword(long id)
Resets the root password from a specific server with the id
|
ResponseAction |
resetServer(long id)
Reset a specific server with the id
|
ResponseAction |
shutdownServer(long id)
Soft-shutdown a specific server with the id
|
ResponseAction |
softRebootServer(long id)
Reboot a specific server with the id
|
ResponseAction |
unassignFloatingIP(long id)
Unassign a Floating IP from a server
|
ResponseImage |
updateImage(long id,
RequestUpdateImage requestUpdateImage)
Update the description or the type of a image.
|
public HetznerCloudAPI(java.lang.String token)
token - which you created in the Hetzner-Cloud consolepublic Servers getServers()
public Servers getServerByName(java.lang.String name)
name - Servername of the serverpublic ResponseGetServer getServerById(long id)
id - The id of the serverpublic ResponseServer createServer(RequestServer requestServer)
requestServer - The new server to create.public ResponseAction deleteServer(long id)
id - Server ID of the server.public ResponseServernameChange changeServerName(long id, RequestServernameChange newServerName)
id - of the servernewServerName - requestpublic ResponseConsole requestConsole(long id)
id - ID of the serverpublic ResponseActions getAllActionsOfServer(long id)
id - ID of the Serverpublic ResponseAction getActionOfServer(long serverID, long actionID)
serverID - ID of the ServeractionID - ID of the Actionpublic ResponseActions getActionsOfFloatingIP(long id)
id - ID of the FloatingIPpublic ResponseAction getActionOfFloatingIP(long floatingIPID, long actionID)
floatingIPID - ID of the Floating IPactionID - ID of the Actionpublic ResponseAction powerOnServer(long id)
id - of the serverpublic ResponseAction powerOffServer(long id)
id - of the serverpublic ResponseAction softRebootServer(long id)
id - of the serverpublic ResponseAction resetServer(long id)
id - of the serverpublic ResponseAction shutdownServer(long id)
id - of the serverpublic ResponseResetPassword resetRootPassword(long id)
id - of the serverpublic ResponseEnableRescue enableRescue(long id)
id - of the serverpublic ResponseEnableRescue enableRescue(long id, RequestEnableRescue requestEnableRescue)
id - of the serverrequestEnableRescue - public ResponseEnableRescue enableRescueAndReset(long id)
id - of the serverpublic ResponseEnableRescue enableRescueAndReset(long id, RequestEnableRescue requestEnableRescue)
id - of the serverrequestEnableRescue - public ResponseAction disableRescue(long id)
Only needed, if the server doesn't booted into the rescue mode.
id - of the serverpublic ResponseRebuildServer rebuildServer(long id, RequestRebuildServer requestRebuildServer)
example: ubuntu-16.04
id - of the serverrequestRebuildServer - public ResponseAction changeServerType(long id, RequestChangeType requestChangeType) throws java.lang.InterruptedException
example: cx11 to cx21
Attention: It will stops the server, but it starts automatically after the upgrade
id - of the serverrequestChangeType - java.lang.InterruptedExceptionpublic ResponseMetrics getMetrics(long id, java.lang.String metricType, java.lang.String start, java.lang.String end)
id - of the servermetricType - like cpu, disk or network (but also cpu,disk possible)start - of the metricend - of the metricpublic ResponseCreateImage createImage(long id, RequestCreateImage requestCreateImage)
id - of the serverrequestCreateImage - public ResponseEnableBackup enableBackup(long id, RequestEnableBackup requestEnableBackup)
Please reminder, that will increase the price of the server by 20%
id - of the serverrequestEnableBackup - public ResponseDisableBackup disableBackup(long id)
Caution!: This will delete all existing backups immediately
id - of the serverpublic ResponseISOS getISOS()
public ResponseISO getISOById(long id)
id - ID of the ISOpublic ResponseAction attachISO(long id, RequestAttachISO requestAttachISO)
To get all ISO's getISOS()
id - of the serverrequestAttachISO - Request objectpublic ResponseAction detachISO(long id)
id - of the serverpublic ResponseAction changeDNSPTR(long id, RequestChangeReverseDNS requestChangeReverseDNS)
Floating IPs assigned to the server are not affected!
id - of the serverrequestChangeReverseDNS - public ResponseDatacenter getDatacenter(long id)
id - of the datacenterpublic ResponseDatacenters getDatacenters()
public ResponseDatacenters getDatacenter(java.lang.String name)
name - of the datacenterpublic ResponsePricing getPricing()
public ResponseFloatingIPs getFloatingIPs()
public ResponseGetFloatingIP getFloatingIP(long id)
id - ID of the Floating IPpublic ResponseFloatingIP createFloatingIP(RequestFloatingIP requestFloatingIP)
requestFloatingIP - Request objectpublic ResponseGetFloatingIP changeDescriptionOfFloatingIP(long id, RequestDescriptionFloatingIP requestDescriptionFloatingIP)
id - ID of the Floating IPrequestDescriptionFloatingIP - Request objectpublic ResponseAction assignFloatingIP(long id, RequestAssignFloatingIP requestAssignFloatingIP)
id - ID of the Floating IPrequestAssignFloatingIP - Request objectpublic ResponseAction unassignFloatingIP(long id)
id - ID of the Floating IPpublic ResponseAction changeFloatingReverseDNS(long id, RequestChangeReverseDNS requestChangeReverseDNS)
id - ID of the Floating IPrequestChangeReverseDNS - Request objectpublic java.lang.String deleteFloatingIP(long id)
This object does not have a respond!
id - ID of the Floating IDpublic ResponseSSHKeys getSSHKeys()
public ResponseSSHKey getSSHKey(long id)
id - ID of the SSH keypublic ResponseSSHKeys getSSHKeyByName(java.lang.String name)
name - name of the SSH keypublic ResponseSSHKey createSSHKey(RequestSSHKey requestSSHKey)
requestSSHKey - Request objectpublic ResponseSSHKey changeSSHKeyName(long id, RequestChangeSSHKeyName requestChangeSSHKeyName)
id - ID of the SSH keyrequestChangeSSHKeyName - Request objectpublic java.lang.String deleteSSHKey(long id)
This object does not have a respond!
id - ID of the SSH keypublic ResponseServerTypes getServerTypes()
public ResponseServerTypes getServerTypeByName(java.lang.String name)
name - name of the Server typepublic ResponseServerType getServerType(long id)
id - ID of the Server typepublic ResponseLocations getLocations()
public ResponseLocations getLocationByName(java.lang.String name)
name - Name of the locationpublic ResponseLocation getLocation(long id)
id - ID of the locationpublic ResponseImages getImages()
public ResponseImages getImages(ImageType type)
type - Type of the imagespublic ResponseImages getImageByName(java.lang.String name)
name - Name of the imagepublic ResponseImage getImage(long id)
id - ID of the imagepublic ResponseImage updateImage(long id, RequestUpdateImage requestUpdateImage)
id - ID of the imagerequestUpdateImage - Request objectpublic java.lang.String deleteImage(long id)
This object does not have a respond!
id - ID of the imagepublic java.lang.String convertToISO8601(java.util.Date date)
date - your Date