-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Primary IPs in client API
Required by #39
- Loading branch information
Showing
5 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/cloud/dnation/jenkins/plugins/hetzner/client/GetAllPrimaryIpsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2022 https://dnation.cloud | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package cloud.dnation.jenkins.plugins.hetzner.client; | ||
|
||
|
||
import com.google.gson.annotations.SerializedName; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
import java.util.List; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") | ||
public class GetAllPrimaryIpsResponse extends AbstractSearchResponse { | ||
@SerializedName("primary_ips") | ||
@NonNull | ||
private List<PrimaryIpDetail> ips; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/main/java/cloud/dnation/jenkins/plugins/hetzner/client/PrimaryIpDetail.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package cloud.dnation.jenkins.plugins.hetzner.client; | ||
|
||
|
||
import com.google.gson.annotations.SerializedName; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
public class PrimaryIpDetail extends IdentifiableResource{ | ||
/** | ||
* ID of the resource the Primary IP is assigned to, null if it is not assigned at all. | ||
*/ | ||
@SerializedName("assignee_id") | ||
private Integer assigneeId; | ||
|
||
/** | ||
* Resource type the Primary IP can be assigned to. | ||
*/ | ||
@SerializedName("assignee_type") | ||
private String assigneeType; | ||
|
||
/** | ||
* Delete this Primary IP when the resource it is assigned to is deleted. | ||
*/ | ||
@SerializedName("auto_delete") | ||
private boolean autoDelete; | ||
|
||
/** | ||
* Whether the IP is blocked. | ||
*/ | ||
private boolean blocked; | ||
|
||
/** | ||
* Point in time when the Resource was created (in ISO-8601 format). | ||
*/ | ||
private String created; | ||
|
||
/** | ||
* Datacenter this Primary IP is located at. | ||
*/ | ||
private DatacenterDetail datacenter; | ||
|
||
/** | ||
* Array of reverse DNS entries. | ||
*/ | ||
@SerializedName("dns_ptr") | ||
private List<Ipv4Detail> dnsPtr; | ||
|
||
/** | ||
* IP address. | ||
*/ | ||
private String ip; | ||
|
||
/** | ||
* User-defined labels (key-value pairs) | ||
*/ | ||
private Map<String, String> labels; | ||
|
||
/** | ||
* Name of the Resource. Must be unique per Project. | ||
*/ | ||
private String name; | ||
|
||
/** | ||
* Type of the Primary IP. | ||
*/ | ||
private String type; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"primary_ips": [ | ||
{ | ||
"id": 7890123, | ||
"name": "primary_ip-123456", | ||
"labels": { | ||
"jenkins": "1" | ||
}, | ||
"created": "2022-07-15T05:21:04.780842+00:00", | ||
"blocked": false, | ||
"datacenter": { | ||
"id": 4, | ||
"name": "fsn1-dc14", | ||
"description": "Falkenstein 1 DC14", | ||
"location": { | ||
"id": 1, | ||
"name": "fsn1", | ||
"description": "Falkenstein DC Park 1", | ||
"country": "DE", | ||
"city": "Falkenstein", | ||
"latitude": 50.47612, | ||
"longitude": 12.370071, | ||
"network_zone": "eu-central" | ||
}, | ||
"server_types": { | ||
"supported": [ | ||
9, | ||
7, | ||
5, | ||
3, | ||
1, | ||
11, | ||
12, | ||
13, | ||
14, | ||
15, | ||
22, | ||
23, | ||
24, | ||
25, | ||
26, | ||
33, | ||
34, | ||
35, | ||
36, | ||
37, | ||
38 | ||
], | ||
"available": [ | ||
1, | ||
3, | ||
5, | ||
7, | ||
9, | ||
11, | ||
12, | ||
13, | ||
14, | ||
15, | ||
22, | ||
23, | ||
24, | ||
25, | ||
26, | ||
33, | ||
34, | ||
35, | ||
36, | ||
37, | ||
38 | ||
], | ||
"available_for_migration": [ | ||
1, | ||
3, | ||
5, | ||
7, | ||
9, | ||
11, | ||
12, | ||
13, | ||
14, | ||
15, | ||
22, | ||
23, | ||
24, | ||
25, | ||
26, | ||
33, | ||
34, | ||
35, | ||
36, | ||
37, | ||
38 | ||
] | ||
} | ||
}, | ||
"ip": "1.2.3.4", | ||
"dns_ptr": [ | ||
{ | ||
"ip": "1.2.3.4", | ||
"dns_ptr": "static.14.3.2.1.clients.your-server.de" | ||
} | ||
], | ||
"protection": { | ||
"delete": false | ||
}, | ||
"type": "ipv4", | ||
"auto_delete": false, | ||
"assignee_type": "server", | ||
"assignee_id": null | ||
} | ||
], | ||
"meta": { | ||
"pagination": { | ||
"page": 1, | ||
"per_page": 25, | ||
"previous_page": null, | ||
"next_page": null, | ||
"last_page": 1, | ||
"total_entries": 1 | ||
} | ||
} | ||
} |