Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Compiled class file
*.class

# Log file
*.log

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
193 changes: 193 additions & 0 deletions services/resourcemanager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# stackit-resourcemanager

Resource Manager API
- API version: 2.0
- Generator version: 7.14.0

API v2 to manage resource containers - organizations, folders, projects incl. labels

### Resource Management
STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations,
folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state.

### Organizations
STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle.
- Organizations are always the root node in resource hierarchy and do not have a parent

### Projects
STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies.
- Projects are optional, but mandatory for cloud-resource usage
- A project can be created having either an organization, or a folder as parent
- A project must not have a project as parent
- Project names under the same parent must not be unique
- Root organization cannot be changed

### Label
STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried.
- Policy-based, immutable labels may exists

For more information, please visit [https://support.stackit.cloud/servicedesk](https://support.stackit.cloud/servicedesk)

*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*


## Requirements

Building the API client library requires:
1. Java 1.8+
2. Maven (3.8.3+)/Gradle (7.2+)

## Installation

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

```shell
mvn clean install
```

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

```shell
mvn clean deploy
```

Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.

### Maven users

Add this dependency to your project's POM:

```xml
<dependency>
<groupId>cloud.stackit</groupId>
<artifactId>stackit-resourcemanager</artifactId>
<version>2.0</version>
<scope>compile</scope>
</dependency>
```

### Gradle users

Add this dependency to your project's build file:

```groovy
repositories {
mavenCentral() // Needed if the 'stackit-resourcemanager' jar has been published to maven central.
mavenLocal() // Needed if the 'stackit-resourcemanager' jar has been published to the local maven repo.
}

dependencies {
implementation "cloud.stackit:stackit-resourcemanager:2.0"
}
```

### Others

At first generate the JAR by executing:

```shell
mvn clean package
```

Then manually install the following JARs:

* `target/stackit-resourcemanager-2.0.jar`
* `target/lib/*.jar`

## Getting Started

Please follow the [installation](#installation) instruction and execute the following Java code:

```java

// Import classes:
import cloud.stackit.resourcemanager.ApiClient;
import cloud.stackit.resourcemanager.ApiException;
import cloud.stackit.resourcemanager.Configuration;
import cloud.stackit.resourcemanager.model.*;
import cloud.stackit.resourcemanager.api.DefaultApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://resource-manager.api.stackit.cloud");

DefaultApi apiInstance = new DefaultApi(defaultClient);
CreateFolderPayload createFolderPayload = new CreateFolderPayload(); // CreateFolderPayload |
try {
FolderResponse result = apiInstance.createFolder(createFolderPayload);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#createFolder");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

```

## Documentation for API Endpoints

All URIs are relative to *https://resource-manager.api.stackit.cloud*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**createFolder**](docs/DefaultApi.md#createFolder) | **POST** /v2/folders | Create Folder
*DefaultApi* | [**createProject**](docs/DefaultApi.md#createProject) | **POST** /v2/projects | Create Project
*DefaultApi* | [**deleteFolder**](docs/DefaultApi.md#deleteFolder) | **DELETE** /v2/folders/{containerId} | Delete Folder
*DefaultApi* | [**deleteFolderLabels**](docs/DefaultApi.md#deleteFolderLabels) | **DELETE** /v2/folders/{containerId}/labels | Delete Folder Labels
*DefaultApi* | [**deleteOrganizationLabels**](docs/DefaultApi.md#deleteOrganizationLabels) | **DELETE** /v2/organizations/{containerId}/labels | Delete Organization Labels
*DefaultApi* | [**deleteProject**](docs/DefaultApi.md#deleteProject) | **DELETE** /v2/projects/{id} | Delete Project
*DefaultApi* | [**deleteProjectLabels**](docs/DefaultApi.md#deleteProjectLabels) | **DELETE** /v2/projects/{containerId}/labels | Delete Project Labels
*DefaultApi* | [**getFolderDetails**](docs/DefaultApi.md#getFolderDetails) | **GET** /v2/folders/{containerId} | Get Folder Details
*DefaultApi* | [**getOrganization**](docs/DefaultApi.md#getOrganization) | **GET** /v2/organizations/{id} | Get Organization Details
*DefaultApi* | [**getProject**](docs/DefaultApi.md#getProject) | **GET** /v2/projects/{id} | Get Project Details
*DefaultApi* | [**listFolders**](docs/DefaultApi.md#listFolders) | **GET** /v2/folders | Get All Folders
*DefaultApi* | [**listOrganizations**](docs/DefaultApi.md#listOrganizations) | **GET** /v2/organizations | Get All Organizations
*DefaultApi* | [**listProjects**](docs/DefaultApi.md#listProjects) | **GET** /v2/projects | Get All Projects
*DefaultApi* | [**partialUpdateFolder**](docs/DefaultApi.md#partialUpdateFolder) | **PATCH** /v2/folders/{containerId} | Update Folder
*DefaultApi* | [**partialUpdateOrganization**](docs/DefaultApi.md#partialUpdateOrganization) | **PATCH** /v2/organizations/{id} | Update Organization
*DefaultApi* | [**partialUpdateProject**](docs/DefaultApi.md#partialUpdateProject) | **PATCH** /v2/projects/{id} | Update Project


## Documentation for Models

- [CreateFolderPayload](docs/CreateFolderPayload.md)
- [CreateProjectPayload](docs/CreateProjectPayload.md)
- [ErrorResponse](docs/ErrorResponse.md)
- [FolderResponse](docs/FolderResponse.md)
- [GetFolderDetailsResponse](docs/GetFolderDetailsResponse.md)
- [GetProjectResponse](docs/GetProjectResponse.md)
- [LifecycleState](docs/LifecycleState.md)
- [ListFoldersResponse](docs/ListFoldersResponse.md)
- [ListFoldersResponseItemsInner](docs/ListFoldersResponseItemsInner.md)
- [ListOrganizationsResponse](docs/ListOrganizationsResponse.md)
- [ListOrganizationsResponseItemsInner](docs/ListOrganizationsResponseItemsInner.md)
- [ListProjectsResponse](docs/ListProjectsResponse.md)
- [Member](docs/Member.md)
- [OrganizationResponse](docs/OrganizationResponse.md)
- [Parent](docs/Parent.md)
- [ParentListInner](docs/ParentListInner.md)
- [PartialUpdateFolderPayload](docs/PartialUpdateFolderPayload.md)
- [PartialUpdateOrganizationPayload](docs/PartialUpdateOrganizationPayload.md)
- [PartialUpdateProjectPayload](docs/PartialUpdateProjectPayload.md)
- [Project](docs/Project.md)


<a id="documentation-for-authorization"></a>
## Documentation for Authorization

Endpoints do not require authorization.


## Recommendation

It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.

## Author



166 changes: 166 additions & 0 deletions services/resourcemanager/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'com.diffplug.spotless'

group = 'cloud.stackit'
version = '2.0'

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0'
}
}

repositories {
mavenCentral()
}
sourceSets {
main.java.srcDirs = ['src/main/java']
}

if(hasProperty('target') && target == 'android') {

apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

// Rename the aar correctly
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}

dependencies {
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
}
}

afterEvaluate {
android.libraryVariants.all { variant ->
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
task.description = "Create jar artifact for ${variant.name}"
task.dependsOn variant.javaCompile
task.from variant.javaCompile.destinationDirectory
task.destinationDirectory = project.file("${project.buildDir}/outputs/jar")
task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar"
artifacts.add('archives', task)
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

artifacts {
archives sourcesJar
}

} else {

apply plugin: 'java'
apply plugin: 'maven-publish'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

publishing {
publications {
maven(MavenPublication) {
artifactId = 'stackit-sdk-resourcemanager'
from components.java
}
}
}

task execute(type:JavaExec) {
main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
}
}

ext {
jakarta_annotation_version = "1.3.5"
}

dependencies {
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'io.gsonfire:gson-fire:1.9.0'
implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6'
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
testImplementation 'org.mockito:mockito-core:3.12.4'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
}

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

// Use spotless plugin to automatically format code, remove unused import, etc
// To apply changes directly to the file, run `gradlew spotlessApply`
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
// comment out below to run spotless as part of the `check` task
enforceCheck false

format 'misc', {
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
target '.gitignore'

// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// don't need to set target, it is inferred from java

// apply a specific flavor of google-java-format
googleJavaFormat('1.8').aosp().reflowLongStrings()

removeUnusedImports()
importOrder()
}
}

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"
}

}
Loading