Skip to content

Commit e44adec

Browse files
committed
chore(sdk): enforce java 8 compatibility
1 parent 5a862d7 commit e44adec

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,15 @@ allprojects {
2424
java {
2525
sourceCompatibility = JavaVersion.VERSION_1_8
2626
targetCompatibility = JavaVersion.VERSION_1_8
27+
28+
toolchain {
29+
languageVersion = JavaLanguageVersion.of(8)
30+
}
2731
}
2832

2933
tasks.withType(JavaCompile).configureEach {
3034
options.encoding = 'UTF-8'
35+
options.release = 8 // enforce java 8 compatibility
3136
}
3237

3338
spotless {
@@ -69,7 +74,6 @@ subprojects {
6974
afterEvaluate { project ->
7075
// only apply to service sub-projects and core
7176
if (project.path.startsWith(':services:') || project.name == "core" ) {
72-
7377
// override the version of each service with the ones obtained from the VERSION files
7478
def versionFile = project.file("VERSION")
7579
if (versionFile.exists()) {

examples/iaas/src/main/java/cloud/stackit/sdk/iaas/examples/IaaSExample.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import cloud.stackit.sdk.iaas.api.IaasApi;
55
import cloud.stackit.sdk.iaas.model.*;
66
import java.io.IOException;
7+
import java.util.Collections;
78
import java.util.Map;
89
import java.util.Objects;
910
import java.util.UUID;
@@ -36,7 +37,7 @@ public static void main(String[] args) throws IOException {
3637
.name("java-sdk-example-network-01")
3738
.dhcp(true)
3839
.routed(false)
39-
.labels(Map.ofEntries(Map.entry("foo", "bar")))
40+
.labels(Collections.singletonMap("foo", "bar"))
4041
.addressFamily(
4142
new CreateNetworkAddressFamily()
4243
.ipv4(
@@ -50,7 +51,7 @@ public static void main(String[] args) throws IOException {
5051
newNetwork.getNetworkId(),
5152
new PartialUpdateNetworkPayload()
5253
.dhcp(false)
53-
.labels(Map.ofEntries(Map.entry("foo", "bar-updated"))));
54+
.labels(Collections.singletonMap("foo", "bar-updated")));
5455

5556
/* fetch the network we just created */
5657
Network fetchedNetwork = iaasApi.getNetwork(projectId, newNetwork.getNetworkId());
@@ -83,7 +84,7 @@ public static void main(String[] args) throws IOException {
8384
/* get an image */
8485
UUID imageId =
8586
images.getItems()
86-
.getFirst()
87+
.get(0)
8788
.getId(); // we just use a random image id in our example
8889
assert imageId != null;
8990
Image fetchedImage = iaasApi.getImage(projectId, imageId);
@@ -119,7 +120,7 @@ public static void main(String[] args) throws IOException {
119120
assert newKeypair.getName() != null;
120121
iaasApi.updateKeyPair(
121122
newKeypair.getName(),
122-
new UpdateKeyPairPayload().labels(Map.ofEntries(Map.entry("foo", "bar"))));
123+
new UpdateKeyPairPayload().labels(Collections.singletonMap("foo", "bar")));
123124

124125
/* fetch the keypair we just created / updated */
125126
Keypair fetchedKeypair = iaasApi.getKeyPair(newKeypair.getName());
@@ -144,7 +145,7 @@ public static void main(String[] args) throws IOException {
144145

145146
/* fetch details about a machine type */
146147
MachineType fetchedMachineType =
147-
iaasApi.getMachineType(projectId, machineTypes.getItems().getFirst().getName());
148+
iaasApi.getMachineType(projectId, machineTypes.getItems().get(0).getName());
148149
System.out.println("\nFetched machine type: ");
149150
System.out.println("* Name: " + fetchedMachineType.getName());
150151
System.out.println("* Description: " + fetchedMachineType.getDescription());
@@ -163,7 +164,7 @@ public static void main(String[] args) throws IOException {
163164
.name("java-sdk-example-server-01")
164165
.machineType("t2i.1")
165166
.imageId(imageId)
166-
.labels(Map.ofEntries(Map.entry("foo", "bar")))
167+
.labels(Collections.singletonMap("foo", "bar"))
167168
// add the keypair we created above
168169
.keypairName(newKeypair.getName())
169170
// add the server to the network we created above
@@ -188,7 +189,7 @@ public static void main(String[] args) throws IOException {
188189
projectId,
189190
newServer.getId(),
190191
new UpdateServerPayload()
191-
.labels(Map.ofEntries(Map.entry("foo", "bar-updated"))));
192+
.labels(Collections.singletonMap("foo", "bar-updated")));
192193

193194
/* list all servers */
194195
ServerListResponse servers = iaasApi.listServers(projectId, false, null);

examples/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/examples/ResourcemanagerExample.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import cloud.stackit.sdk.resourcemanager.model.FolderResponse;
88
import cloud.stackit.sdk.resourcemanager.model.Project;
99
import java.io.IOException;
10+
import java.util.Collections;
1011
import java.util.Map;
1112
import java.util.UUID;
1213

@@ -25,14 +26,14 @@ public static void main(String[] args) throws IOException {
2526
resourceManagerApi.createProject(
2627
new CreateProjectPayload()
2728
.containerParentId(containerParentId.toString())
28-
.labels(Map.ofEntries(Map.entry("foo", "bar"))));
29+
.labels(Collections.singletonMap("foo", "bar")));
2930

3031
/* create a folder */
3132
FolderResponse folder =
3233
resourceManagerApi.createFolder(
3334
new CreateFolderPayload()
3435
.containerParentId(containerParentId.toString())
35-
.labels(Map.ofEntries(Map.entry("foo", "bar"))));
36+
.labels(Collections.singletonMap("foo", "bar")));
3637
} catch (ApiException e) {
3738
throw new RuntimeException(e);
3839
}

0 commit comments

Comments
 (0)