Skip to content

Commit 6ee8f9b

Browse files
committed
feat(iaas): initial onboarding
relates to STACKITSDK-209
1 parent 2f10254 commit 6ee8f9b

File tree

143 files changed

+66385
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+66385
-0
lines changed

services/iaas/README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# stackit-sdk-iaas
2+
3+
IaaS-API
4+
5+
- API version: 1
6+
7+
This API allows you to create and modify IaaS resources.
8+
9+
For more information, please visit [https://support.stackit.cloud/servicedesk](https://support.stackit.cloud/servicedesk)
10+
11+
This package is part of the STACKIT Java SDK. For additional information, please visit the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-java) of the SDK.
12+
13+
14+
## Requirements
15+
16+
Building the API client library requires:
17+
1. Java SDK (version 11 to 21 should be supported) installed on your system
18+
19+
## Installation
20+
21+
To install the API client library to your local Maven repository, simply execute:
22+
23+
```shell
24+
./gradlew publishToMavenLocal
25+
```
26+
27+
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
28+
29+
```shell
30+
# TODO: follow up story
31+
# ./gradlew publishToMavenCentral
32+
```
33+
34+
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
35+
36+
### Maven users
37+
38+
Add this dependency to your project's POM:
39+
40+
```xml
41+
<dependency>
42+
<groupId>cloud.stackit</groupId>
43+
<artifactId>stackit-sdk-iaas</artifactId>
44+
<version><SDK_VERSION></version>
45+
<scope>compile</scope>
46+
</dependency>
47+
```
48+
49+
### Gradle users
50+
51+
Add this dependency to your project's build file:
52+
53+
```groovy
54+
repositories {
55+
mavenCentral() // Needed if the 'stackit-sdk-iaas' jar has been published to maven central.
56+
mavenLocal() // Needed if the 'stackit-sdk-iaas' jar has been published to the local maven repo.
57+
}
58+
59+
dependencies {
60+
implementation "cloud.stackit:stackit-sdk-iaas:<SDK_VERSION>"
61+
}
62+
```
63+
64+
### Others
65+
66+
At first generate the JAR by executing:
67+
68+
```shell
69+
mvn clean package
70+
```
71+
72+
Then manually install the following JARs:
73+
74+
- `target/stackit-sdk-iaas-<SDK_VERSION>.jar`
75+
- `target/lib/*.jar`
76+
77+
## Getting Started
78+
79+
Please follow the [installation](#installation) instruction and execute the following Java code:
80+
81+
```java
82+
83+
import cloud.stackit.sdk.iaas.*;
84+
import cloud.stackit.sdk.iaas.auth.*;
85+
import cloud.stackit.sdk.iaas.model.*;
86+
import cloud.stackit.sdk.iaas.api.DefaultApi;
87+
88+
public class DefaultApiExample {
89+
90+
public static void main(String[] args) {
91+
ApiClient defaultClient = Configuration.getDefaultApiClient();
92+
defaultClient.setBasePath("https://iaas.api.eu01.stackit.cloud");
93+
94+
DefaultApi apiInstance = new DefaultApi(defaultClient);
95+
UUID projectId = UUID.randomUUID(); // UUID | The identifier (ID) of a STACKIT Project.
96+
UUID serverId = UUID.randomUUID(); // UUID | The identifier (ID) of a STACKIT Server.
97+
UUID networkId = UUID.randomUUID(); // UUID | The identifier (ID) of a STACKIT Network.
98+
try {
99+
apiInstance.addNetworkToServer(projectId, serverId, networkId);
100+
} catch (ApiException e) {
101+
System.err.println("Exception when calling DefaultApi#addNetworkToServer");
102+
System.err.println("Status code: " + e.getCode());
103+
System.err.println("Reason: " + e.getResponseBody());
104+
System.err.println("Response headers: " + e.getResponseHeaders());
105+
e.printStackTrace();
106+
}
107+
}
108+
}
109+
110+
```
111+
112+
## Recommendation
113+
114+
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.

services/iaas/build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
ext {
3+
jakarta_annotation_version = "1.3.5"
4+
}
5+
6+
dependencies {
7+
implementation "com.google.code.findbugs:jsr305:3.0.2"
8+
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
9+
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
10+
implementation 'com.google.code.gson:gson:2.9.1'
11+
implementation 'io.gsonfire:gson-fire:1.9.0'
12+
implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6'
13+
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
14+
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
15+
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
16+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
17+
testImplementation 'org.mockito:mockito-core:3.12.4'
18+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
19+
}

services/iaas/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = "stackit-sdk-iaas"
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* IaaS-API
3+
* This API allows you to create and modify IaaS resources.
4+
*
5+
* The version of the OpenAPI document: 1
6+
* Contact: [email protected]
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
package cloud.stackit.sdk.iaas;
14+
15+
import java.util.List;
16+
import java.util.Map;
17+
18+
/**
19+
* Callback for asynchronous API call.
20+
*
21+
* @param <T> The return type
22+
*/
23+
public interface ApiCallback<T> {
24+
/**
25+
* This is called when the API call fails.
26+
*
27+
* @param e The exception causing the failure
28+
* @param statusCode Status code of the response if available, otherwise it would be 0
29+
* @param responseHeaders Headers of the response if available, otherwise it would be null
30+
*/
31+
void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders);
32+
33+
/**
34+
* This is called when the API call succeeded.
35+
*
36+
* @param result The result deserialized from response
37+
* @param statusCode Status code of the response
38+
* @param responseHeaders Headers of the response
39+
*/
40+
void onSuccess(T result, int statusCode, Map<String, List<String>> responseHeaders);
41+
42+
/**
43+
* This is called when the API upload processing.
44+
*
45+
* @param bytesWritten bytes Written
46+
* @param contentLength content length of request body
47+
* @param done write end
48+
*/
49+
void onUploadProgress(long bytesWritten, long contentLength, boolean done);
50+
51+
/**
52+
* This is called when the API download processing.
53+
*
54+
* @param bytesRead bytes Read
55+
* @param contentLength content length of the response
56+
* @param done Read end
57+
*/
58+
void onDownloadProgress(long bytesRead, long contentLength, boolean done);
59+
}

0 commit comments

Comments
 (0)