Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
38 changes: 38 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
pull_request:
workflow_dispatch:
push:
branches: ["main"]

jobs:
main:
name: CI
runs-on: ubuntu-latest
strategy:
matrix:
version: [11, 17, 21]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '${{ matrix.version }}'
cache: 'gradle'

- name: Check code format
run: ./gradlew spotlessCheck

- name: Test
run: make test

- name: Build
run: make build

- name: Publish to local maven repo
run: make install

7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ gradle-app.setting
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
.classpath

*.iws
*.iml
*.ipr
.idea
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build:
@./gradlew build

fmt:
@./gradlew spotlessApply

test:
@./gradlew test

install:
@./gradlew publishToMavenLocal
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,25 @@ This repository contains the STACKIT SDKs for Java.

If you encounter any issues or have suggestions for improvements, please open an issue in the repository or create a ticket in the [STACKIT Help Center](https://support.stackit.cloud/).

## Development

Building the STACKIT Java SDK requires:
1. Java SDK (version 11 to 21 should be supported) installed on your system

In case you want to open the project in your preferred IDE, run `./gradlew idea` or `./gradlew eclipse` beforehand.

## Installation

To install the API client library to your local Maven repository, simply execute:

```bash
./gradlew publishToMavenLocal
```

## Release creation

See the [release documentation](./RELEASE.md) for further information.

## License

Apache 2.0
Apache 2.0
142 changes: 142 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
plugins {
id 'java'
id 'maven-publish'
id 'idea'
id 'eclipse'

id 'com.diffplug.spotless' version '6.21.0'
}


allprojects {
apply plugin: 'com.diffplug.spotless'

repositories {
mavenCentral()
}

javadoc {
options.tags = [
"http.response.details:a:Http Response Details"
]
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

spotless {
groovyGradle {
greclipse()

trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
}
format 'misc', {
target '.gitattributes', '.gitignore'

trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
}
java {
googleJavaFormat().aosp()

removeUnusedImports()
importOrder()
formatAnnotations()
trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
}
}
}

subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'idea'
apply plugin: 'eclipse'

group = 'cloud.stackit'
version = 'SNAPSHOT'

afterEvaluate { project ->
// only apply to service sub-projects and core
if (project.path.startsWith(':services:') || project.name == "core" ) {

// override the version of each service with the ones obtained from the VERSION files
def versionFile = project.file("VERSION")
if (versionFile.exists()) {
try {
version = versionFile.text.trim()
} catch (IOException e) {
logger.error("Could not read VERSION file for project '${project.name}': ${e.message}")
}
} else {
logger.warn("VERSION file not found in project '${project.name}'. Skipping version setting.")
}


publishing {
publications {
maven(MavenPublication) {
artifactId = "stackit-sdk-${project.name}"
from components.java

pom {
name.set(project.name)
description.set("STACKIT Java SDK for the ${project.name} service")
url.set("https://github.com/stackitcloud/stackit-sdk-java/tree/main/services/${rootProject.name}")
licenses {
license {
name.set("Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("stackitcloud") // TODO: not clear which value must be placed here, check this when setting up publishment to Maven Central
name.set("STACKIT Developer Tools")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/stackitcloud/${rootProject.name}.git")
developerConnection.set("scm:git:ssh://github.com/stackitcloud/${rootProject.name}.git")
url.set("https://github.com/stackitcloud/${rootProject.name}")
}
}
}
}
repositories {
mavenLocal()
}
}
}
}

tasks.withType(Test) {
// Enable JUnit 5 (Gradle 4.6+).
useJUnitPlatform()

// Always run tests, even when nothing changed.
dependsOn 'cleanTest'

// Show test results.
testLogging {
events "passed", "skipped", "failed"
}
}

dependencies {
if (project.path != ':core') {
// prevent circular dependency
implementation project(':core')
}
}
}
1 change: 1 addition & 0 deletions core/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1-SNAPSHOT
1 change: 1 addition & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions core/src/main/java/cloud/stackit/sdk/core/CoreDummy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package cloud.stackit.sdk.core;

public class CoreDummy {}
3 changes: 3 additions & 0 deletions examples/resourcemanager/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies {
implementation project (':services:resourcemanager')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package cloud.stackit.sdk.resourcemanager.examples;

import cloud.stackit.sdk.resourcemanager.ApiClient;
import cloud.stackit.sdk.resourcemanager.ApiException;
import cloud.stackit.sdk.resourcemanager.api.DefaultApi;
import cloud.stackit.sdk.resourcemanager.model.CreateFolderPayload;
import cloud.stackit.sdk.resourcemanager.model.CreateProjectPayload;
import cloud.stackit.sdk.resourcemanager.model.FolderResponse;
import cloud.stackit.sdk.resourcemanager.model.Project;
import java.util.Map;
import java.util.UUID;

class ResourcemanagerExample {
public static void main(String[] args) {
ApiClient apiClient = new ApiClient();
DefaultApi resourceManagerApi = new DefaultApi(apiClient);

// replace this with something useful for real use
UUID containerParentId = UUID.randomUUID();

try {
/* create a project */
Project project =
resourceManagerApi.createProject(
new CreateProjectPayload()
.containerParentId(containerParentId.toString())
.labels(Map.ofEntries(Map.entry("foo", "bar"))));

/* create a folder */
FolderResponse folder =
resourceManagerApi.createFolder(
new CreateFolderPayload()
.containerParentId(containerParentId.toString())
.labels(Map.ofEntries(Map.entry("foo", "bar"))));
} catch (ApiException e) {
throw new RuntimeException(e);
}
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion services/resourcemanager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This package is part of the STACKIT Java SDK. For additional information, please
## Requirements

Building the API client library requires:
1. Java 1.8+
1. Java SDK (version 11 to 21 should be supported) installed on your system

## Installation

Expand Down
1 change: 1 addition & 0 deletions services/resourcemanager/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1-SNAPSHOT
Loading